我正在尝试在 Windows 系统上的 Spring Boot 项目中使用 ELK 管理日志。 项目层次结构如下。
docker-compose.yml 中的代码
version: '2.20.4'
services:
Elasticsearch:
image: elasticsearch:7.16.2
container_name: elasticsearch
restart: always
volumes:
- elastic_data:/usr/share/elasticsearch/data/
environment:
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
discovery.type: single-node
ports:
- '9200:9200'
- '9300:9300'
networks:
- elk
Logstash:
image: logstash:7.16.2
container_name: logstash
restart: always
volumes:
- ./logstash/config/logstash.yml:/dc-demo-main/logstash/config/logstash.yml:ro
- ./logstash/pipeline:/dc-demo-main/logstash/pipeline:ro
command: logstash -f /dc-demo-main/logstash/logstash.conf
depends_on:
- Elasticsearch
ports:
- '9600:9600'
environment:
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
- elk
Kibana:
image: kibana:7.16.2
container_name: kibana
restart: always
ports:
- '5601:5601'
environment:
- ELASTICSEARCH_URL=http://elasticsearch:9200
depends_on:
- Elasticsearch
networks:
- elk
volumes:
elastic_data: {}
networks:
elk:
logstash.conf
input{
file{
path => "C:/ELK_Logs/elk-stack.log"
start_position => "beginning"
}
}
output{
stdout{
codec=>rubydebug
}
elasticsearch{
hosts => ["http://elasticsearch:9200"]
}
}
logstash.yml
http.host: "0.0.0.0"
path.config: /dc-demo-main/logstash/pipeline
xpack.monitoring.elasticsearch.hosts: [ "localhost:9200" ]
Elastic Search 仪表板日志未填充 当尝试在logstash.conf文件中创建索引时,索引也没有被创建。当我尝试在 http://localhost:9200/_cat/indices 下搜索时
请查看官方文档:
所以conf文件的默认路径是:/usr/share/logstash/pipeline 但您的命令正在 /dc-demo-main/logstash/logstash.conf
下寻找它我觉得这个值得一试。