elasticsearch Filebeat未在Elasticsearch中创建索引
我正在设置Filebeat以将日志发送到Elasticsearch。这是我的elasticsearch Filebeat未在Elasticsearch中创建索引,elasticsearch,kibana,filebeat,elasticsearch,Kibana,Filebeat,我正在设置Filebeat以将日志发送到Elasticsearch。这是我的filebeat.yml: filebeat.prospectors: - type: log paths: - '/var/log/project/*.log' json.message_key: message output.elasticsearch: hosts: ["localhost:9200"] 我有一个包含以下内容的文件/var/log/project/test.log: { "mes
filebeat.yml
:
filebeat.prospectors:
- type: log
paths:
- '/var/log/project/*.log'
json.message_key: message
output.elasticsearch:
hosts: ["localhost:9200"]
我有一个包含以下内容的文件/var/log/project/test.log
:
{ "message": "This is a test" }
我希望这个日志会被发送到Elasticsearch。Elasticsearch在localhost的Docker容器中运行,地址为9200
当我运行filebeat(Docker)时,Elasticsearch中没有创建索引。所以,在基巴纳,我没有看到任何数据
为什么呢?Filebeat不是自动创建索引吗?您可以按如下方式创建索引
output.elasticsearch:
hosts: ["localhost:9200"]
index: "test-%{+yyyy.MM.dd}"
解决了!我并没有在主机和Filebeat容器之间共享日志目录,所以并没有要发送的日志 我在运行Filebeat时添加了一个卷:
docker run -it -v $(pwd)/filebeat.yml:/usr/share/filebeat/filebeat.yml -v /var/log/project/:/var/log/project/ docker.elastic.co/beats/filebeat:6.4.0