Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by crazy-duck (Novice)
on Jul 09, 2015 at 23:40 UTC ( #1134058=perlquestion: print w/replies, xml ) Need Help??
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 (Abbot) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1134058]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-11-13 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (149 votes). Check out past polls.

    Notices?