goaccess 설치 & 설정 & 사용법

1. 설치

1) source 파일을 다운받아 컴파일 하든지 : https://goaccess.io/download

2) yum -y install goaccess

 

* nginx log format

log_format main ‘$http_x_forwarded_for – $remote_user [$time_local] “$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent”‘ ‘”$remote_addr”‘;

* vhost 별 log 설정 : access_log /var/log/nginx/galgulee.com.access.log main;

 

$http_x_forwarded_for: cloudflare 를 사용 하므로 수정..

 

2. 사용법

1) goaccess -f /var/log/nginx//galgulee.com.access.log -a

2) 단축키 :

tab키 : 다음 항목

enter : 펼치기

상세목록 창에서 다음 항목 : j / 이전 항목 k

빠져나오기 / 종료 : q

 

3. 설정 : /etc/goaccess.conf

time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] “%r” %s %b “%R” “%u”
exclude-ip 제외하고싶은 ip ex)회사
enable-panel VISITORS
enable-panel REQUESTS
enable-panel REQUESTS_STATIC
enable-panel NOT_FOUND
enable-panel HOSTS
enable-panel OS
enable-panel BROWSERS
enable-panel VISIT_TIMES
enable-panel VIRTUAL_HOSTS
enable-panel REFERRERS
enable-panel REFERRING_SITES
enable-panel KEYPHRASES
enable-panel STATUS_CODES
enable-panel REMOTE_USER
enable-panel GEO_LOCATION
#ignore-panel VISITORS
#ignore-panel REQUESTS
#ignore-panel REQUESTS_STATIC
#ignore-panel NOT_FOUND
#ignore-panel HOSTS
#ignore-panel OS
#ignore-panel BROWSERS
#ignore-panel VISIT_TIMES
#ignore-panel VIRTUAL_HOSTS
#ignore-panel REFERRERS
#ignore-panel REFERRING_SITES
#ignore-panel KEYPHRASES
#ignore-panel STATUS_CODES
#ignore-panel REMOTE_USER
ignore-referer *.galgulee.com
# 제외할 도메인 ex) 내 도메인내…
ignore-referer ww?.galgulee.com
ignore-referer galgulee.*
# 항목들 봐서 적당하게… 추가
static-file .eot

 

5. 압축파일 여러개 한 번에 보기

zcat -f /var/log/nginx/galgulee.com.access.* | goaccess /var/log/nginx/galgulee.com.access.log –log-format=COMBINED -a

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다