1

I need some help with parsing my log, tried several times and can't get it to be parsed.

Here is its format from the config we use:

log_format upstream_time_log '$host $remote_addr - $remote_user [$time_local] '
                          '"$request" $status $body_bytes_sent '
                          '"$http_referer" "$http_user_agent" $request_time $upstream_response_time $upstream_response_length';

and a sample string:

ourhost.com 91.234.31.36 - - [19/Sep/2016:07:46:51 +0000] "GET /url/goes/here/ HTTP/1.1" 302 154 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" 0.000 - -

2 Answers 2

4

This bash script nginx2goaccess can convert the format from nginx to goaccess

Example this command:

./nginx2goaccess.sh '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"'

Produce:

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

Try this:

log-format %v %h %^[%d:%t %^] "%r" %s %b "%R" "%u" %T %^
date-format %d/%b/%Y
time-format %T
0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.