telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

[[inputs.tail]] does not work on nginx 1.20

Open matheuscfr opened this issue 2 years ago • 2 comments

Hello guys. I'm studying about telegraf passing the data to prometheus and displaying the data in grafana. The nginx log is not passing through telegraf.

[[inputs.nginx]]
   urls = ["http://localhost/nginx_status"]
   response_timeout = "5s"
[[inputs.tail]]
  name_override = "nginxlog"
  files = ["/var/log/nginx/access.log"]
  from_beginning = true
  pipe = false
  data_format = "grok"
  grok_patterns = ["%{COMBINED_LOG_FORMAT}"]
[[inputs.cpu]]
  percpu = true
[[inputs.disk]]
[[inputs.diskio]]
[[inputs.io]]
[[inputs.net]]
[[inputs.mem]]
[[inputs.system]]

This code is working on nginx(1.18.0 - ubuntu), but on nginx(1.20.1 - centos) it doesn't. I need you to pass this log to perform the metrics in grafana.

nginxlog_http_version{agent="Go-http-client/1.1",auth="-",client_ip="127.0.0.1",host="ubuntu",ident="-",path="/var/log/nginx/access.log",referrer="-",request="/nginx_status",resp_code="200",verb="GET"} 1.1

nginxlog_resp_bytes{agent="Go-http-client/1.1",auth="-",client_ip="127.0.0.1",host="ubuntu",ident="-",path="/var/log/nginx/access.log",referrer="-",request="/nginx_status",resp_code="200",verb="GET"} 101

matheuscfr avatar Jul 14 '22 15:07 matheuscfr

Hello! I recommend posting this question in our Community Slack or Community Page, we have a lot of talented community members there who could help answer your question more quickly. You can also learn more about Telegraf by enrolling at InfluxDB University for free!

Heads up, this issue will be automatically closed after 7 days of inactivity. Thank you!

telegraf-tiger[bot] avatar Jul 14 '22 15:07 telegraf-tiger[bot]

Hey @matheuscfr, do you know if the log format changed between the versions? Is there any error message?

srebhan avatar Jul 15 '22 10:07 srebhan

Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Page. Thank you!

telegraf-tiger[bot] avatar Oct 06 '22 18:10 telegraf-tiger[bot]

Answer: https://community.influxdata.com/t/telegraf-is-not-reading-nginx-access-log-file-data-on-nginx-1-20/25752

melroy89 avatar Mar 06 '23 23:03 melroy89