This page looks best with JavaScript enabled

telegraf log rotate

 ·  ☕ 1 min read  ·  ✍️ CheeseMocha

should setup the log rotate size from 0mbg to a properly number, otherwise it will not work.

  ## Log target controls the destination for logs and can be one of "file",
  ## "stderr" or, on Windows, "eventlog".  When set to "file", the output file
  ## is determined by the "logfile" setting.
  logtarget = "file"

  ## Name of the file to be logged to when using the "file" logtarget.  If set to
  ## the empty string then logs are written to stderr.
  logfile = "/var/log/telegraf/telegraf.log"

  ## The logfile will be rotated after the time interval specified.  When set
  ## to 0 no time based rotation is performed.  Logs are rotated only when
  ## written to, if there is no log activity rotation may be delayed.
  logfile_rotation_interval = "1d"

  ## The logfile will be rotated when it becomes larger than the specified
  ## size.  When set to 0 no size based rotation is performed.
  logfile_rotation_max_size = "20MB"

  ## Maximum number of rotated archives to keep, any older logs are deleted.
  ## If set to -1, no archives are removed.
  logfile_rotation_max_archives = 7

  ## Override default hostname, if empty use os.Hostname()
  hostname = "****"
  ## If set to true, do no set the "host" tag in the telegraf agent.
  omit_hostname = false
Share on

cheesemocha