Created
October 25, 2013 07:35
-
-
Save CNG/1e78acd613599ae0666b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
root@app:~# date; | |
Thu Oct 24 22:59:57 CDT 2013 | |
root@app:~# cd /var/log/apache2; mkdir combined_error_logs; | |
root@app:/var/log/apache2# rsync -a -e ssh root@www1:/var/log/apache2/error* combined_error_logs/www1;You have new mail in /var/mail/root | |
root@app:/var/log/apache2# rsync -a -e ssh root@www2:/var/log/apache2/error* combined_error_logs/www2;You have new mail in /var/mail/root | |
root@app:/var/log/apache2# date; | |
Thu Oct 24 23:02:03 CDT 2013 | |
root@app:/var/log/apache2# cd combined_error_logs/www1; gunzip *.gz; cd ../..; | |
root@app:/var/log/apache2# cd combined_error_logs/www2; gunzip *.gz; cd ../..; | |
root@app:/var/log/apache2# date; | |
Thu Oct 24 23:05:41 CDT 2013 | |
root@app:/var/log/apache2# cat combined_error_logs/*/* | sed -r -n 's/^\[(\w+) (\w+ \w+) ..:..:.. (\w+).+/\3 \2 \1/p' | awk '{count[$1]++}END{for(j in count) print j" "count[j]}' FS=: | sort > errors_by_date.$(date +%Y-%m-%d).txt; | |
root@app:/var/log/apache2# rm -rf combined_error_logs; | |
root@app:/var/log/apache2# date; | |
Fri Oct 25 01:34:30 CDT 2013 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment