How to take the derivative of a log

how to take the derivative of a log

Powershell - How to select a block of text from a text based log file that has a time stamp in the log file entry

Sorry if the Title isn't very clear, I think part of my issue is I can't think of a way to clearly describe what I am trying to acheive, which has not helped me in 'Googling' anything that may be of help.

I am trying to create a generic script / function that I can pass 2 time values, a start time and an end time that will output all log file entries between these 2 time stamps. This will become the core part of a script to extract very small time spans of log file entries from logfiles that often exceed 1GB a day and are very difficult to manipulate in file viewers or editors efficiently and therefore take significant time to extract relevant dta from, for the purpose of providing developers with data to aid investigations into problems.

The log files are of differing formats but most of these follow the general format below:

I have created a basic function:

which if I run it using the following command line

it will output only the logfile lines that have the timestamp of 22:19:58: in the line, which is fine, it was what I initally wanted to acheive, but since this point the requirement has expanded.

What I now want to be able to do is to provide a start time and an end time and have all lines between these output.

I have tried to implement a do while loop to do this but was obvioulsy not getting anywhere as I couldn't acheive the goal I am trying to reach.

So I have a few questions.

Updated Code:

OK, so here's a code segment tweaked as advised by PSGuy below, which works a treat with logfiles that have a time stamp entry on every line.:


Category: Bank

Similar articles: