Logstash 找不到logstash.conf 文件

问题描述 投票:0回答:1

我正在尝试在 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 下搜索时

spring-boot elasticsearch logging logstash kibana
1个回答
0
投票

请查看官方文档:

Docker 镜像的目录布局

所以conf文件的默认路径是:/usr/share/logstash/pipeline 但您的命令正在 /dc-demo-main/logstash/logstash.conf

下寻找它

我觉得这个值得一试。

© www.soinside.com 2019 - 2024. All rights reserved.