嗨,我一直在使用弹性堆栈进行自动日志记录。我的意思filebeat
是从路径读取日志,输出设置为通过端口的 logstash 5044
。logstash 配置有一个输入监听5044
和输出推送到 localhost:9200。问题是我无法让它工作,我不知道发生了什么。以下是文件:
我的 filebeat.yml路径:etc/filebeat/filebeat.yml
#=========================== Filebeat prospectors =============================
filebeat.prospectors:
# Each - is a prospector. Most options can be set at the prospector level, so
# you can use different prospectors for various configurations.
# Below are the prospector specific configurations.
- input_type: log
# Paths that should be crawled and fetched. Glob based paths.
paths:
- /mnt/vol1/autosuggest/logs/*.log
#- c:\programdata\elasticsearch\logs\*
<other commented stuff>
#----------------------------- Logstash output --------------------------------
output.logstash:
# The Logstash hosts
hosts: ["10.10.XX.XX:5044"]
# Optional SSL. By default is off.
<other commented stuff>
我的 logstash.yml路径:etc/logstash/logstash.yml
<other commented stuff>
path.data: /var/lib/logstash
<other commented stuff>
path.config: /etc/logstash/conf.d
<other commented stuff>
# ------------ Metrics Settings --------------
#
# Bind address for the metrics REST endpoint
#
http.host: "10.10.XX.XX"
#
# Bind port for the metrics REST endpoint, this option also accept a range
# (9600-9700) and logstash will pick up the first available ports.
#
# http.port: 9600-9700
<other commented stuff>
path.logs: /var/log/logstash
<other commented stuff>
我的 logpipeline30aug.config 文件路径:/usr/share/logstash
input {
beats {
port => 5044
}
}
filter {
grok {
match => { "message" => "\A%{TIMESTAMP_ISO8601:timestamp}%{SPACE}%{WORD:var0}%{SPACE}%{NOTSPACE}%{SPACE}(?<searchinfo>[^#]*)#(?<username>[^#]*)#(?<searchQuery>[^#]*)#(?<latitude>[^#]*)#(?<longitude>[^#]*)#(?<client_ip>[^#]*)#(?<responseTime>[^#]*)" }
}
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "logstash30aug2017"
document_type => "log"
}
}
请注意: Elasticsearch、logstash、filebeat 都安装在具有 ip: 的同一台机器上10.10.XX.XX
,我已经检查了防火墙,这肯定不是问题。
我检查了logstash、filebeat 服务都在运行。Filebeat能够在配置时将数据推送到elasticsearch,并且logstash在配置时能够将数据推送到elasticsearch。
也许这是我执行过程的方式的问题。我做了一个bin/logstash -f logpipeline30aug.config
in/usr/share/logstash
来启动它,然后我/etc/init.d/filebeat start
从根目录做一个。
请注意:由于 stackoverflow 格式问题,格式可能会受到影响
有人可以帮忙吗?我从 3 天以来一直在尝试一切,我也浏览了文档
您的 filebeat.yml 看起来无效。
输出部分缺少缩进:
output.logstash:
hosts: ["10.10.XX.XX:5044"]
通常,检查配置文件的正确性以确保它们没问题。
例如,对于 filebeat,您可以运行:
filebeat -c /etc/filebeat/filebeat.yml -configtest
如果您有任何错误,它会解释该错误是什么,以便您可以修复它。
您也可以对其他 ELK 服务使用类似的方法
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句