Answer the question
In order to leave comments, you need to log in
How to pick up logs from the server for a certain time?
I need to collect logs for 2019.12.30
and 2019.12.31 between 21:30:00 and
21:39:59 2019/12/apache_2019-12-31.txt >> main.txt , but I can't figure out how to pick it up in a certain time
Answer the question
In order to leave comments, you need to log in
is in 1 click search
https://stackoverflow.com/questions/17238908/how-t...
And so the logic is simple you do
cat you.log | grep "условие по дате" | grep "ваше условие че вы там ищете" | grep " тут еще условие" > 111.txt
|
tail -f | grep
since you, unlike opening the log, look here in realtime mode, it is very convenient for work. If you need a specific hour, then yes - grep | zgrep
grep "2019-12-30\s09:" .../2019/12/apache_2019-12-30.txt
But there could still be an ambush with logrotation not necessarily set to 00:00.
We tried several toulouse, but ended up scribbling our own.
We have nginx in syslogd, we wrote datagram reception ourselves, although at first we used logstash, but it turned out that everything is simple there. The daemon listens on the port, accepts datagrams, bites off the header, turns the log line into a json string and shoves it into solr.
Then the self-written web muzzle gives you whatever you want, with selections and sortings ...
... even I wrote this, and was surprised - how difficult it is :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question