-
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
Log to /var/log/telegraf/telegraf.log on systems using systemd #4174
Comments
Well,
Line above in So, just to clarify, what is the problem exactly? set
or, force isn't sufficient? |
We should probably set |
Re-iteration, and elaboration on #4184 (comment)
This is not inherently true. By default systemd does not log to any (plain text) files at all. I would say that if the user wants these files created on a systemd based system, it is up to that user to do so. There are 3 ways they can do it.
I would also vote that it is up to the OS package maintainers to make this decision. Then the package defaults can be tailored to the expectations of that distribution. The native vendor-provided unit file should provide an out of the box configuration idiomatic to the service management system. |
Thank you @phemmer this is really good advice. Since this is not systemd/journald related we shouldn't make any changes to its configuration.
Of course for the official packages this is me :). I think what seems best is to add a rsyslog config to Certainly we should make sure that maintainers for Gentoo, FreeBSD, and other platforms can easily create a well behaving package. |
On ubuntu 18.04 also with: [agent]
interval = "30s"
collection_jitter = "20s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
flush_interval = "45s"
flush_jitter = "15s"
precision = ""
debug = false
quiet = true
logfile = "/dev/null"
omit_hostname = false Logs will apear on syslog tail -n 1 /var/log/syslog
May 25 21:15:57 ns1 telegraf[481]: cpu,cpu=cpu0,host=serv1,usage_user=0,usage_nice=0,usage_iowait=2.846219201359371,usage_irq=0,usage_guest=0,usage_guest_nice=0,usage_system=0.2124044180118932,usage_idle=96.94137638062861,usage_softirq=0,usage_steal=0 1558818909000000000 How could we completly disable telegraf logs to syslog? |
@mhf-ir It looks like you probably have the file output enabled, normally Telegraf does not log this type of data. If you disable the file output it should be very quiet with that configuration. |
Sorry my bad, you're right. 👍 |
I hit the same problem - forgot |
my "messages" file under /var/log/ directory is filling with telegraf messages. i have enabled below configs. so any help will be appreciated. debug = false |
@mahish512 @vladak @mhf-ir you can change the It can be stopped by adding the following to prevent # /usr/lib/systemd/system/telegraf.service
[Service]
StandardOutput=null
StandardError=journal # don't forget, sometimes the unit file is not reloaded ;)
systemctl daemon-reload
systemctl restart telegraf.service It even works if you have [[outputs.file]]
files = ["stdout","/tmp/metrics.out"]
rotation_max_size = "50MB"
rotation_max_archives = 4
data_format = "influx" Then you can use the agent settings on top. [agent]
debug = false
quiet = true
logtarget = "file"
logfile = "/var/log/telegraf/telegraf.log" @danielnelson I think there is no need to change anything of the default as there are all combinations possible. Furthermore Hope it helps. |
none of these settings in the config are working for me on latest telegraf on Ubuntu |
As there is a workaround I'm closing this issue. @yosiasz if your issue still exists, please open a new issue with more details on your configuration, expected behavior etc. Thanks @cellcoresystems for providing your solution! |
Feature Request
Proposal:
On systems using sysvinit, logs are set to write to
/var/log/telegraf/telegraf.log
. For systems using systemd the logs instead end up in/var/log/messages
, the/var/log/telegraf
directory remains empty.Current behavior:
/var/log/messages
Desired behavior:
/var/log/telegraf/telegraf.log
The text was updated successfully, but these errors were encountered: