Code Monkey home page Code Monkey logo

webresponsecheck's Introduction

WebResponseCheck

Example of a PowerShell script that can read and output from a log file.

Straight forward PowerShell script that can be used to read a log file with an example log style.

To run (using PowerShell):

path/to/directory/WebResponseCheckv3.ps1

Log Transaction sample:

2022-06-10T09:46:37.330 6300c7d4-dec5-43cf-af65-f9700745d33b GET /doc/comments - - - frontend19
2022-06-10T09:46:37.490 6300c7d4-dec5-43cf-af65-f9700745d33b HANDLE - - - - worker36
2022-06-10T09:46:37.600 6300c7d4-dec5-43cf-af65-f9700745d33b RESPOND - - 200 - frontend19

Log file is in a simple format with the following fields:

datestamp, request GUID, action type, requested url, -, status, -, server/worker id

The .ps1 will prompt for the path of the log file and then will prompt for a location to save the log file:

File Path prompts

This will take some time depending on the size of the log file so be patient :)

Once the script has ran, the console will display an output to show any server that has a response time of over 500ms and will order them by their average highest response time:

Script Completed

The response time can be configured by editing the .ps1 file on line 50 for POST to HANDLE actions and line 80 for HANDLE to RESPOND actions:

Response Time Edit line_50 Response Time Edit line_80

The log output file that is generated contains the same statistics as the console but also includes all of the entries that matches the criteria from the log. For example:

sameple-output.log

This script should run on any Windows system. I have attached 2x sample logs - a full size log with 600,000 log entries and a significantly shortened version with only 1000 lines (much quicker for testing). I have also attached a sample output file to show what you can expect - sample_output.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.