我正在试验一些按照Elasticsearch格式化的Elasticsearch,所以我直接从Filebeat转到Elasticsearch,而不是通过Logstash。这是使用docker-compose
version: '2.2'
services:
  elasticsearch:
    container_name: elasticsearch
    image: docker.elastic.co/elasticsearch/elasticsearch:7.5.2
    ports:
      - 9200:9200
      - 9300:9300
    environment:
      - discovery.type=single-node
      - cluster.name=docker-
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    networks:
      - esnet
  filebeat:
    container_name: filebeat
    build:
      context: .
      dockerfile: filebeat.Dockerfile
    volumes:
      - ./logs:/var/log
      - ./filebeat/filebeat.yml:/usr/share/filebeat/filebeat.yml
    networks:
      - esnet  
  elastichq:
    container_name: elastichq
    image: elastichq/elasticsearch-hq
    ports:
      - 8080:5000
    environment:
      - HQ_DEFAULT_URL=http://elasticsearch:9200
      - HQ_ENABLE_SSL=False
      - HQ_DEBUG=FALSE
    networks:
      - esnet  
networks:
  esnet: 但是,当我打开ElasticHQ时,索引名已被标记为带有日期戳的filebeat-7.5.2-2020.02.10-000001。我已经在我的index中将Sample名称指定为Sample。我是不是错过了什么,或者这种行为正常吗?
这是我的filebeat.yml
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/log/*.json
  json.keys_under_root: true
  json.add_error_key: true 
#----------------------------- Elasticsearch output --------------------------------
output.elasticsearch:
  hosts: ["elasticsearch:9200"]
  index: "sample-%{+YYYY.MM.dd}"
setup.template.name: "sample"
setup.template.pattern: "sample-*"如果我使用Postman而不是ElasticHQ,我就可以开始查询我的数据,而不必查找index名称。
https://stackoverflow.com/questions/60154246
复制相似问题