0

我正在使用 Filebeat > Logstash > Elasticsearch > Kibana 来解析和分析日志,基本上是 Java Stack Trace 和其他日志。

这是 Filebeat 的 YML

filebeat:
  prospectors:
    -
      paths:
        - C:\logs\OCR\example.log
      input_type: log
      #document_type: UAT_EXAMPLE
      exclude_lines: [".+DEBUG"]
      multiline:
         pattern: ".+(ERROR|INFO)"
         negate: true
         match: after
      fields:
         app_name: EXAMPLE_APP
         environment: UAT
      fields_under_root: true
      #force_close_files: true
      spool_size: 2048
      #publish_async: true
      #scan_frequency: 10s
      #close_older: 2h

output:
  logstash:
    host: "10.0.64.14"
    port: 5044
    index: filebeat
    timeout: 5
    reconnect_interval: 3
    bulk_max_size: 2048

shipper:
 tags: ["ABC_Engine", "UAT_EXAMPLE"]
 queue_size: 1000

###  Enable logging of the filebeat
logging:
  level: warning
  to_files: true
  files:
    path: c:\logs\
    name: mybeat.log
    rotateeverybytes: 20485760 # = 20MB
    keepfiles: 7

启用文件节拍的日志记录也不适用于 Windows。如果我在这里遗漏了什么,请告诉我。

logging:
   level: warning
   to_files: true
   files:
      path: c:\logs\
      name: mybeat.log
      rotateeverybytes: 20485760 # = 20MB
      keepfiles: 7

问题 - Filebeat 有时无法将日志发送到 logstash,有时它会开始运行运输,但有时它不会。虽然如果我使用“test.log”作为探矿者并通过下面的配置将日志本地保存在磁盘上,它运行良好。

将文件写入本地文件以检查输出。我已经一一尝试了“文件”输出和“logstash”输出。

output:
file:
path: c:\logs\
filename: filebeat
rotate_every_kb: 100000
number_of_files: 7

另外,当我使用命令行时,这些东西大多会运行。:

.\filebeat.exe -c filebeat.yml -e -v

请协助正确配置 Windows。日志文件“example.log”每 30 MB 大小轮换一次。

我不太确定使用以下属性以及它们将如何与 Windows 上的 Filebeat 一起使用。

“close_older” “ignore_older” “记录”

4

1 回答 1

0

输出到logstash:

评论弹性搜索行

然后

logstash:
  # The Logstash hosts
   hosts: ["localhost:5044"]

保持 []

并配置登录调试模式,例如

logging:
# Send all logging output to syslog. On Windows default is false, otherwise
# default is true.
#to_syslog: true

# Write all logging output to files. Beats automatically rotate files if      rotateeverybytes
# limit is reached.
#to_files: false

# To enable logging to files, to_files option has to be set to true
 files:
# The directory where the log files will written to.
#path: /var/log/mybeat
path: c:\PROGRA~1/filebeat

# The name of the files where the logs are written to.
name: filebeat.log

# Configure log file size limit. If limit is reached, log file will be
# automatically rotated
rotateeverybytes: 10485760 # = 10MB

# Number of rotated log files to keep. Oldest files will be deleted first.
#keepfiles: 7

# Enable debug output for selected components. To enable all selectors use    ["*"]
# Other available selectors are beat, publish, service
# Multiple selectors can be chained.
#selectors: [ ]

# Sets log level. The default log level is error.
# Available log levels are: critical, error, warning, info, debug
 level: debug

LOGGING 在 LOGGING 部分,输出是 logstash 或弹性搜索,如果你想知道可以作为服务安装,请访问 elastic.co 网站:

https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation.html

于 2016-08-10T13:20:03.670 回答