我有存储在json文件中的测试结果。然后,我让logstash找到该文件,并尝试将所有行发送到elasticsearch。只有大约一半的行正在被发送,并且无法弄清楚为什么某些行被省略。例如,将有34行,但只发送了14行。
input {
file {
path => "/data/*.json"
start_position => "beginning"
}
}
# ----------------------------------------------------------------------
filter {
# Parse fields out of JSON message, then remove the raw JSON.
json {
source => "message"
}
}
# ----------------------------------------------------------------------
output {
elasticsearch {
hosts => ["host:9200", "localhost:9200"]
index => "ct-%{+YYYY.MM.dd}"
}
stdout { codec => rubydebug }
我不确定是json本身有什么原因导致logstash跳过它,还是我在上面发布的logstash.conf文件有问题。
发布于 2019-04-19 16:41:47
Logstash计算不同类型的文件,并将其以Json格式发送到elasticsearch。在您的示例中,具有elasticsearch输出的Filebeat代理足以将json文件发送到ES并对其进行索引。
使用Filebeat 6.x时,它看起来如下所示:
#=========================== Filebeat inputs =============================
filebeat.inputs:
- type: log
# Paths to the logs
paths:
- "/your/path/to/your/logs/file.json"
# tags to identify the logs source, .gz files excluded from the prospector
tags: ["beats","yourtag"]
exclude_files: ['\.gz$']
#================================ Outputs =====================================
#----------------------------- Elasticsearch output --------------------------------
output.elasticsearch:
# The ES host & index name
hosts: ["yourEShost:9200"]
index: "ct-%{+YYYY.MM.dd}"
https://stackoverflow.com/questions/55749746
复制相似问题