GoAccess是一款开源、实时,运行在命令行终端下的web日志分析工具。
安装:
0 1 2 3 4 5 |
$ wget http://tar.goaccess.io/goaccess-1.2.tar.gz $ tar -xzvf goaccess-1.2.tar.gz $ cd goaccess-1.2/ $ ./configure --enable-utf8 --enable-geoip=legacy $ make # make install |
Nginx日志格式:
0 1 2 |
log_format access '$http_x_forwarded_for $remote_user [$time_local] ' '$request $status $body_bytes_sent $http_referer ' '$http_user_agent $remote_addr'; |
nginx日志:
0 1 |
- - [02/Jun/2017:09:11:42 +0800] GET / HTTP/1.0 200 31535 - ApacheBench/2.3 192.168.2.111 1.1.1.1 - [02/Jun/2017:09:23:10 +0800] GET /index.php HTTP/1.1 200 6507 https://note.t4x.org/index.php Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36 120.27.1.1 |
GoAccess配置文件:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
[root@www ~]# egrep -v "^$|#" /usr/local/etc/goaccess.conf time-format %H:%M:%S date-format %d/%b/%Y log_format %h %^[%d:%t %^] %m %U %H %s %b %R %u %^ %D %^ config-dialog false hl-header true json-pretty-print false no-color false no-column-names false no-csv-summary false no-progress false no-tab-scroll false with-mouse false agent-list false with-output-resolver false http-method yes http-protocol yes no-query-string false no-term-resolver false 444-as-404 false 4xx-to-unique-count false all-static-files false double-decode false ignore-crawlers false crawlers-only false ignore-panel REFERRERS ignore-panel KEYPHRASES real-os true static-file .css static-file .js static-file .jpg static-file .png static-file .gif static-file .ico static-file .jpeg static-file .pdf static-file .txt static-file .csv static-file .zip static-file .mp3 static-file .mp4 static-file .mpeg static-file .mpg static-file .exe static-file .swf static-file .woff static-file .woff2 static-file .xls static-file .xlsx static-file .doc static-file .docx static-file .ppt static-file .pptx static-file .iso static-file .gz static-file .rar static-file .svg static-file .bmp static-file .tar static-file .tgz static-file .tiff static-file .tif static-file .ttf static-file .flv |
官方:https://goaccess.io/downloadSourceByrd's Weblog-https://note.t4x.org/basic/goaccess-nginx-logs/ SourceByrd's Weblog-https://note.t4x.org/basic/goaccess-nginx-logs/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!