gpt4 book ai didi

docker - Filebeat甚至没有成功将日志发送到Logstash

转载 作者:行者123 更新时间:2023-12-03 02:31:27 26 4
gpt4 key购买 nike

我正在尝试使用ELK空间来收集文件日志。一切正常,直到filebeat集成。我可以通过tcp将日志发送到logstash并在kibana中查看。
但是我无法实现filebeat设置来发送日志。它接缝发送数据,但在elasticsearch中看不到。

使用此命令创建elasticsearch。
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --name elasticsearch docker.elastic.co/elasticsearch/elasticsearch:7.5.2
基巴纳语:
docker run -d -p 5601:5601 -h kibana --name kibana --link elasticsearch:elasticsearch docker.elastic.co/kibana/kibana:7.5.2
Logstash:
docker run -d -p 5044:5044 -p 5000:5000 -h logstash --name logstash --link elasticsearch:elasticsearch -v c:/elk2/config-dir:/config-dir docker.elastic.co/logstash/logstash:7.5.2 -f /config-dir/logstash.conf
Logstash.conf文件

input {
beats {
type => "test"
port => "5044"
}
}

filter {
#If log line contains tab character followed by 'at' then we will tag that entry as stacktrace
if [message] =~ "\tat" {
grok {
match => ["message", "^(\tat)"]
add_tag => ["stacktrace"]
}
}

}

output {

stdout {
codec => rubydebug
}

# Sending properly parsed log events to elasticsearch
elasticsearch {
hosts => ["elasticsearch:9200"]
}
}

在Windows 10计算机上运行filebeat。下载的zip和filebeat.yml配置
filebeat.modules:
filebeat.inputs:
- type: log
enabled: true
paths:
- C:/elk2/filebeat/log/*.log
multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
multiline.negate: true
multiline.match: after

output:
logstash:
hosts: ["localhost:5044"]
#Also tried 127.0.0.1/logstash/ip... as hosts here

首先将Powershell作为管理员模式运行
./install-service-filebeat.ps1
然后
./filebeat.exe -c ./filebeat.yml
2020-01-26T22:28:45.652+0300    INFO    log/harvester.go:251    Harvester started for file: C:\elk2\filebeat\log\logstash-mehmet.log
2020-01-26T22:29:15.651+0300 INFO [monitoring] log/log.go:145 Non-zero metrics in the last 30s {"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":250,"time":{"ms":250}},"total":{"ticks":343,"time":{"ms":343},"value":343},"user":{"ticks":93,"time":{"ms":93}}},"handles":{"open":664},"info":{"ephemeral_id":"46f26124-44e5-4733-a259-4bed65d07a05","uptime":{"ms":32977}},"memstats":{"gc_next":9518416,"memory_alloc":6349856,"memory_total":10791408,"rss":39120896},"runtime":{"goroutines":28}},"filebeat":{"events":{"added":2,"done":2},"harvester":{"open_files":1,"running":1,"started":1}},"libbeat":{"config":{"module":{"running":0}},"output":{"type":"logstash"},"pipeline":{"clients":1,"events":{"active":0,"filtered":2,"total":2}}},"registrar":{"states":{"current":1,"update":2},"writes":{"success":2,"total":2}},"system":{"cpu":{"cores":8}}}}}

但是 Elasticsearch 没有结果。

最佳答案

尝试删除端口中的反逗号

input {
beats {
type => "test"
port => 5044
}
}

关于docker - Filebeat甚至没有成功将日志发送到Logstash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59922314/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com