Goaccess: Custom format with only IP and UA

Created on 14 Oct 2019  路  11Comments  路  Source: allinurl/goaccess

here is my nginx access_log conf

log_format  main_ext  '$remote_addr - "$http_user_agent"';

a sample of the access log file

156.195.xx.xx - "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
lodattime format question

All 11 comments

GoAccess requires the following fields:

a valid IPv4/6 %h
a valid date %d
the request %r

@allinurl
What is the minimum log format in Nginx?

Not sure. I'm guessing only one field?

@allinurl
My bad, I meant for goaccess

my current log format as you saw is

log_format  main_ext  '$remote_addr - "$http_user_agent"';

as i'm only interested in logging IP's, OS and Browsers.

What else should I add as a minimum so that goaccess would accept my log file ? or anyway i could bypass that?

@allinurl

As per your guideline, this is my log format now

    log_format  main_ext  '$remote_addr - $remote_user [$time_local]'
                          '"$request" "$http_user_agent"' ;

and when i start goaccess i use this command

goaccess -f /var/log/nginx/site-access.*

Then I choose NCSA Combined Log Format and then I delete %s %b "%R" from log format

My question is how can I append this to my command?

I found the solution and its working great !!
I just need you to confirm if it's right

goaccess -f /var/log/nginx/site-access.* --log-format="%h %^[%d:%t %^] "%r" "%u"" --date-format="%d/%b/%Y" --time-format="%H:%M:%S"

Glad you got it work. That looks right to me for the minimum amount of data.

@allinurl

just one last question, how to add several panels in --ignore-panel ?

I want to add these

REQUESTS_STATIC NOT_FOUND VISIT_TIMES REFERRERS REFERRING_SITES KEYPHRASES STATUS_CODES
--ignore-panel=REQUESTS_STATIC --ignore-panel=NOT_FOUND --ignore-panel=VISIT_TIMES --ignore-panel=REFERRERS --ignore-panel=REFERRING_SITES --ignore-panel=KEYPHRASES --ignore-panel=STATUS_CODES

or if you prefer & cleaner, through the config file.

@allinurl

Well, I will stick with this now. Thank you very much for your time :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SerenaAi picture SerenaAi  路  3Comments

g33kphr33k picture g33kphr33k  路  3Comments

tbarbette picture tbarbette  路  3Comments

Gill-Bates picture Gill-Bates  路  3Comments

SergioDG-YCC picture SergioDG-YCC  路  3Comments