crazy-duck has asked for the wisdom of the Perl Monks concerning the following question:

Help on capturing only latest entries or lines from a logfile(Since last scan/read) on windows

We have plain text file which gets appended with latest events if any specific to application on a windows server, We check the application log file every 1 hour, it will be great help if there is any sample perl script which can achieve this.All we want to do is read the new events and write it to a new logfile.

  • Comment on Help on capturing only latest entries or lines from a logfile(Since last scan/read) on windows

Replies are listed 'Best First'.
Re: Help on capturing only latest entries or lines from a logfile(Since last scan/read) on windows
by afoken (Chancellor) on Jul 10, 2015 at 10:16 UTC

    Save the log file size to a helper file when your log reader script ends. When the log reader script starts again, read the old log file size back, then open the log file and seek to the old file size.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: Help on capturing only latest entries or lines from a logfile(Since last scan/read) on windows
by i5513 (Pilgrim) on Jul 10, 2015 at 11:51 UTC
    Maybe you can be interested on porting logtail2 to windows (or finding an similar stuff on windows)
    If you install coreutils on windows, you could use "tac file | grep -m 5 xxx" to see the last 5 times where xxx appeared on the file
    Regards
Re: Help on capturing only latest events from a logfile on windows
by Anonymous Monk on Jul 09, 2015 at 23:55 UTC
A reply falls below the community's threshold of quality. You may see it by logging in.