filebeat collect log

filebeat:
  prospectors:
    -
      paths:
                - /path/to/mysql-slow.log
      document_type: mysql-slow
      fields:
        type: mysql-slow
        tags: mysql-host
    -
      paths:
                - /path/to/mysql-error.log
      document_type: mysql-error
      fields:
        type: mysql-error
        tags: mysql-host
    -
      paths:
                - /path/to/dmesg
      document_type: dmesg
      fields:
        type: dmesg
        tags: mysql-host

      encoding: plain
      input_type: log
      fields_under_root: true 
      # 每 10 秒鐘掃描一次目錄,更新通配符匹配上的文件列表
      scan_frequency: "10s"
      # buffer size every harvester uses when fetching the file
      harvester_buffer_size: 16384
      # read from bottom of file
      tail_files: false
      # check logfile whether to read or not every n second
      backoff: "3s"
  # Event count spool threshold
  spool_size: 1000
  # Defines how often the spooler is flushed. 
  # Flush even though spool_size is not reached
  idle_timeout: "10s"
  # registry file path
  registry_file: /opt/opbin/filebeat/registry

output:
  logstash:
    hosts: ["127.0.0.1:5140"]

#shipper:
logging:
  level: info
  to_files: true
  to_syslog: false
  files:
      path: /opt/opbin/filebeat/mybeat
      name: mybeat.log
      rotateeverybytes: 10485760
      keepfiles: 10
相關文章
相關標籤/搜索