Please enable Javascript to view the contents

telegraf 项目中应用

 ·  ☕ 1 分钟  ·  ✍️ CheeseMocha

telegraf 设置 日志归档 时候,注意需要在指定的out_put file 里面修改 0MB 为一共具体的数字,不然日志是无法归档的。

  ## 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
分享

cheesemocha