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

Change log format to let Logwatch work with no modification #4

Open
taro-k opened this issue May 20, 2016 · 2 comments
Open

Change log format to let Logwatch work with no modification #4

taro-k opened this issue May 20, 2016 · 2 comments
Assignees

Comments

@taro-k
Copy link

taro-k commented May 20, 2016

If we change Nginx log format by following the instruction, httpd section of Logwatch doesn't work.
To solve this problem, we can change setting of Logwatch, however, I think it's much better that no such change/modification is required.

Do you have a specific reason for the suggested format?

If no, I'd recommend that the log format is combined+request_time:

'$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time';

, which is OK with Logwatch at least my server.
If you can accept this, I can make PR of the corresponding code.

@t-cyrill
Copy link
Owner

munin-nginx_request_time don't take care of logwatch.
Generally, logwatch watch nginx's access_log that is placed /var/log/nginx/access.log.

If you don't want to track access.log, you can change log name to add nginx access_log directive.
And modify your logwatch configration to exclude tsv access log (request_time_stats.log).

nginx.conf

log_format main '$remote_addr - $remote_user [$time_local] '
                '"$request" $status $body_bytes_sent '
                '"$http_referer" "$http_user_agent" '
                '$request_time';
log_format request_time_stats   '$time_local\t'
                                '$status\t'
                                '$request_time\t'
                                '$remote_addr\t'
                                '$upstream_addr\t'
                                '$upstream_response_time\t'
                                '$request';

access_log  /var/log/nginx/access.log  main;
access_log  /var/log/nginx/request_time_stats.log request_time_stats;

logwatch/conf/logfiles/nginx.conf

LogFile = nginx/access.log

Thank you.

@t-cyrill t-cyrill self-assigned this Jun 12, 2016
@taro-k
Copy link
Author

taro-k commented Jul 15, 2016

taro-k@803eb1b

If you modify the code like this commit, we don't need such duplicate log as you wrote. At the same time, Logwatch works correctly.

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

No branches or pull requests

2 participants