Goaccess 로그 형식

goaccess 로그 파일 분석기에 사용 가능한, Discourse 도커 설치에서 생성된 nginx 로그에 맞는 로그 파일 포맷을 알고 계신 분 계신가요? 작성하는 데 어려움을 겪고 있습니다.

자, 제 질문에 대한 답변을 드리자면…

docker 컨테이너의 로그 파일 형식은 다음과 같습니다:

log_format log_discourse ‘[$time_local] “$http_host” $remote_addr “$request” “$http_user_agent” “$sent_http_x_discourse_route” $status $bytes_sent “$http_referer” $upstream_response_time $request_time “$upstream_http_x_discourse_username” “$upstream_http_x_discourse_trackview” “$upstream_http_x_queue_time” “$upstream_http_x_redis_calls” “$upstream_http_x_redis_time” “$upstream_http_x_sql_calls” “$upstream_http_x_sql_time”’;

이 형식을 파싱하여 .goaccess 로그 파일 형식을 생성할 수 있는 유틸리티 스크립트가 GitHub에 있습니다:

출력은 다음과 같습니다:

time-format %T
date-format %d/%b/%Y
log_format [%d:%t %^] “%v” %h “%r” “%u” “%^” %s %b “%R” %^ %T “%^” “%^” “%^” “%^” “%^” “%^” “%^”

이것을 직접 작성하는 것은 꽤 어렵습니다. 미래에 다른 분들에게 유용할 것 같아 공유합니다.

goaccess 프로그램은 매우 훌륭한 로그 파일 분석 도구입니다.

GoAccess - Visual Web Log Analyzer