Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom log format request #1681

Open
KarelWintersky opened this issue Feb 25, 2020 · 4 comments
Open

Custom log format request #1681

KarelWintersky opened this issue Feb 25, 2020 · 4 comments

Comments

@KarelWintersky
Copy link

@KarelWintersky KarelWintersky commented Feb 25, 2020

My custom log format are:

log_format upstream_time
    '($status) | [$time_local] | $remote_addr | '
    'RequestTime: $request_time | '
    'UpstreamConnect: $upstream_connect_time | UpstreamResponse: $upstream_response_time | '
    'Request: "$request" | '
    'Referrer: "$http_referer" '
;

How I can use it with GoAccess?

@allinurl

This comment has been minimized.

Copy link
Owner

@allinurl allinurl commented Feb 25, 2020

Please post a few lines from your access log. Thanks

@KarelWintersky

This comment has been minimized.

Copy link
Author

@KarelWintersky KarelWintersky commented Feb 26, 2020

(200) | [24/Feb/2020:06:25:05 +0300] | 37.9.113.142 | RequestTime: 3.057 | UpstreamConnect: 0.000 | UpstreamResponse: 3.060 | Request: "GET /comments/page4579/ HTTP/1.1" | Referrer: "-"
(200) | [24/Feb/2020:06:25:07 +0300] | 37.9.113.142 | RequestTime: 0.778 | UpstreamConnect: 0.000 | UpstreamResponse: 0.776 | Request: "GET /tag/Something%20Went%20Wrong/ HTTP/1.1" | Referrer: "-"
(200) | [24/Feb/2020:06:25:22 +0300] | 37.9.113.142 | RequestTime: 1.563 | UpstreamConnect: 0.000 | UpstreamResponse: 1.564 | Request: "GET /profile/MyAinsel/created/comments/page152/ HTTP/1.1" | Referrer: "-"
(200) | [24/Feb/2020:06:25:25 +0300] | 37.9.113.142 | RequestTime: 0.013 | UpstreamConnect: 0.000 | UpstreamResponse: 0.016 | Request: "GET /vote_view.php?comment_id=223217 HTTP/1.1" | Referrer: "-"
(200) | [24/Feb/2020:06:25:28 +0300] | 80.83.237.60 | RequestTime: 1.208 | UpstreamConnect: 0.000 | UpstreamResponse: 1.208 | Request: "GET /p/singleplayer-ili-pochemu-mne-ponravilos-vodit-odnogo-igroka.html HTTP/1.1" | Referrer: "https://www.google.com/"

Can I define custom log format at commandline or inside config file using something like directive:

LogFormat FOOBAR '.....'  

?
Or attach nginx config as rule ?

@allinurl

This comment has been minimized.

Copy link
Owner

@allinurl allinurl commented Feb 28, 2020

This should do it:

goaccess access.log --log-format='(%s) %^[%d:%t %^] %^ %h %^: %T %^"%r" %^"%R"' --date-format=%d/%b/%Y --time-format=%T
@KarelWintersky

This comment has been minimized.

Copy link
Author

@KarelWintersky KarelWintersky commented Feb 28, 2020

I'll try, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.