Last active
December 16, 2015 08:09
-
-
Save milanaleksic/5403790 to your computer and use it in GitHub Desktop.
Count number of lines in log per day with specific string (good found counting number of server restarts for example)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
perl -e 'use POSIX qw(strftime); $i=0; while($i<10) { $dt=strftime "%Y-%m-%d",localtime(time()- 3600*$i*24); print $dt.": "; print `cat server.log | grep "server restarted" | grep -c "$dt"`; $i++; }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment