Skip to content

logfile plugin

Plugin name logfile
Type log
Callbacks config, log, notification
Status supported
Since 3.9
Copyright 2007 Sebastian Harl, 2007–2008 Florian Forster
License MIT License
Configuration collectd.conf(5)

The LogFile plugin receives log messages from the daemon and writes them to a text file.

In order for other plugins to be able to report errors and warnings during initialization, the LogFile plugin should be loaded as one of the first plugins, if not as the first plugin. This means that its LoadPlugin line should be one of the first lines in the configuration file.

Synopsis

 LoadPlugin "logfile"
 <Plugin "logfile">
   LogLevel "info"
   File "/var/log/collectd.log"
   Timestamp true
 </Plugin>

Dependencies

  • none

See also

Configuration

Configuration options · from collectd.conf(5)

See this section in the full configuration reference

LogLevel debug|info|notice|warning|err

Sets the log-level. If, for example, set to notice, then all events with severity notice, warning, or err will be written to the logfile.

Please note that debug is only available if collectd has been compiled with debugging support.

File File
Sets the file to write log messages to. The special strings stdout and stderr can be used to write to the standard output and standard error channels, respectively. This, of course, only makes much sense when collectd is running in foreground- or non-daemon-mode.
Timestamp true|false
Prefix all lines printed by the current time. Defaults to true.
PrintSeverity true|false
When enabled, all lines are prefixed by the severity of the log message, for example "warning". Defaults to false.

Note: There is no need to notify the daemon after moving or removing the log file (e. g. when rotating the logs). The plugin reopens the file for each line it writes.