influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.9k stars 5.6k forks source link

logparser should error and exit on permissions errors #1418

Closed ahivert closed 8 years ago

ahivert commented 8 years ago

I'm testing the awesome new logparser plugin but I have trouble to made it work.

Actually with this version

Telegraf - version 1.0.0-beta2

Running it on Ubuntu 14.04

This is my conf with logparser

[[inputs.logparser]]
    files = [ "/var/log/nginx/access.log" ]
  [inputs.logparser.grok]
    patterns = [ "%{COMMONAPACHELOG} %{QS:referrer} %{QS:agent}" ]

This settings works when I type telegraf in my console but not work when I launch telegraf with service telegraf start

When I launch telegraf in my console I can see the lines

Loaded inputs: cpu disk diskio net nginx logparser mem system
Seeked /var/log/nginx/access.log - &{Offset:0 Whence:2}

But when I launch it from service telegraf start this is the lines in logfile

Loaded inputs: diskio net nginx logparser mem system cpu disk

The line with Seeked is not presents

If I set only the logparser plugin, there is 0 metric gathered.

Maybe this is normal due to the beta release ?

abarban commented 8 years ago

Similar issue on RedHat EL5! Also with tail plugin!

sparrc commented 8 years ago

It's probably a permissions issue, try running sudo -u telegraf telegraf -config ..., the telegraf user must have permission to access that file.

sparrc commented 8 years ago

that being said, if it is a permissions issue, there should be an error message about that.

ahivert commented 8 years ago

I just made the test and you're right @sparrc this is about permission on log file.

Thank you !

Add an error message to the log will help the user. :)

mpchadwick commented 8 years ago

I installed Telegraf this morning and configured logparser. Nothing's been written all day, and I suspect its permissions. Telegraf gives no indicator of that in /var/log/telegraf/telegraf.log, though