Skip to content

Instantly share code, notes, and snippets.

@thomaspuppe
Created April 16, 2015 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomaspuppe/a6580f7891cde71254b3 to your computer and use it in GitHub Desktop.
Save thomaspuppe/a6580f7891cde71254b3 to your computer and use it in GitHub Desktop.
Log-Analyse in der Konsole

Log-Analyse

Kopieren und verbinden

$ scp user@1.2.3.4:/var/log/apache/www.domain.com.log ~/2015-04-16_log-analyse/www1.domain.com.log
$ scp user@1.2.3.4:/var/log/apache/www.domain.com.log ~/2015-04-16_log-analyse/www2.domain.com.log

$ cd ~/2015-04-16_log-analyse

$ grep "2015-04-16 15" www1.domain.com.log > www.domain.com_1500-1559.log
$ grep "2015-04-16 15" www2.domain.com.log >> www.domain.com_1500-1559.log

Sortieren nach Spalte "Dauer in microseconds"

$ sort -n -k4 www.domain.com_1500-1559.log > www.domain.com_1500-1559_sorted.log

Ausgabe der Requests pro Minute

$ awk '{print $2}' www.domain.com_1500-1559.log | cut -d: -f2 | sort -n | uniq -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment