-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Logparser plugin process half of lines when nginx access log buffer is enabled #3613
Comments
I also discovered this effect. We use buffer=32k . I already discussed with Daniel in this thread: https://community.influxdata.com/t/telegraf-logparser-and-duplicate-data-points/3346
More info on the nginx side, but even flushing the buffer more frequently would not help for sure I guess, because different worker processe seem to have their own buffers: |
@vvxvv @bolek2000 Checking in if this is still an issue. We are evaluating enhancements to the |
I am not sure if this problem is solved (I guess no), because we built a workaround that is still in place. We have our own nginx access log preprocessing script, which sorts time slices of buffered logs chronologically and then appends the sorted lines to a new logfile, which gets ingested by inputs.tail plugin. I'm not sure if I will have the time to investigate this again in detail. But you could test how telegraf constructs the time stamps and tag sets in a scenario where the same tag sets reoccur at the same nginx timestamp. When log buffering is enabled, the nginx workers spit out the log lines unchronologically. The same nginx timestamp can reoccur multiple times, so if the timesamp+offset+tagset reoccurs then ist will be overwitten in InfluxDB and metrics get lost. |
Bug report
Relevant telegraf.conf:
[[inputs.logparser]]
files = ["/var/log/nginx/fastcgi-metrics.log"]
from_beginning = false
[inputs.logparser.grok]
patterns = ["%{NGINX_FCGI_METRICS}"]
measurement = "fcgi_metrics"
custom_patterns = '''
NGINX_FCGI_METRICS [%{HTTPDATE:ts:ts-httpd}] %{IPORHOST:server:tag} %{NUMBER:status:tag} %{NUMBER:upstream_status:tag} %{NUMBER:upstream_response_time:float} %{WORD:upstream_cache_status:tag}
'''
*** nginx.conf:
log_format telegraf '[$time_local] $server_name $status $upstream_status '
'$upstream_response_time $upstream_cache_status';
access_log /var/log/nginx/fastcgi-metrics.log telegraf buffer=1m flush=1;
System info:
OS: Debian Stretch
telegraf: v1.5
Steps to reproduce:
The text was updated successfully, but these errors were encountered: