Hello guys, I am writing a log parser script, i've got the problemm please look: I want to print the lines from big file that were added for last 5 minutes my scenario: 1. read the file from the end untill date in file < current date on 300 secs:
# tac /var/log/biglog | perl -ne 'print; exit 0 if (($DateCurrent -$D +ate) > 300 );'
where $DateCurrent - current date in unix timestamp: date +%s $Date - the date from log file, but the problem here is that it has format that I cannot convert to unixtimestamp for compare:
any ideas?# tail -3 biglog 78.49.150.102 - - [01/Nov/2011:00:53:01 +0600] "GET /mem.png HTTP/1.1" + 200 51883 "http://net.com/" "Opera/9.80 (Windows NT 6.1; U; ru) Pres +to/2.9.168 Version/11.52" 78.49.150.102 - - [01/Nov/2011:00:53:01 +0600] "GET /cpu.png HTTP/1.1" + 200 42875 "http://net.com/" "Opera/9.80 (Windows NT 6.1; U; ru) Pres +to/2.9.168 Version/11.52" 78.49.150.102 - - [01/Nov/2011:00:53:01 +0600] "GET /traf.png HTTP/1.1 +" 200 48121 "http://net.com/" "Opera/9.80 (Windows NT 6.1; U; ru) Pre +sto/2.9.168 Version/11.52"
Original content restored above by GrandFather
thanks, guys!In reply to How to read last lines from file? by httpd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |