Qualcuno ha un formato di file di log per l’analizzatore di file di log goaccess che funzioni per i log nginx prodotti dall’installazione docker di Discourse? Ho difficoltà a scriverlo.
Bene, rispondo alla mia domanda…
Il formato del file di log nel container 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"’;
C’è uno script di utilità che può analizzare questo e produrre il formato del file di log .goaccess su GitHub:
Ecco l’output:
time-format %T
date-format %d/%b/%Y
log_format [%d:%t %^] "%v" %h "%r" "%u" "%^" %s %b "%R" %^ %T "%^" "%^" "%^" "%^" "%^" "%^" "%^"
Abbastanza difficile scriverlo da soli. Pensavo che questo potesse essere utile per altri in futuro.
Il programma goaccess è un ottimo analizzatore di file di log web.