繁体   English   中英

索引名称未在 Filebeat 中设置为 Elasticsearch - ELK .NET Docker ElasticHQ

[英]Index Name Not Being Set in Filebeat to Elasticsearch - ELK .NET Docker ElasticHQ

我正在试验一些按照Elasticsearch格式化的json ,所以我直接从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 我在filebeat.yml index名称指定为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名称。

我认为Filebeat ILM可能会接管而不是配置的索引名称。

从 7.0 版本开始,Filebeat 在连接到支持生命周期管理的集群时默认使用索引生命周期管理。 Filebeat 自动加载默认策略并将其应用于 Filebeat 创建的任何索引。

并且当启用 ilm 时 Filebeat Elasticsearch 输出索引设置被忽略

启用索引生命周期管理时,将忽略索引设置。 如果您要将事件发送到支持索引生命周期管理的集群,请参阅配置索引生命周期管理以了解如何更改索引名称。

您可能需要禁用 ILM 或更好地使用 ILM rollover_alias 配置所需的文件名。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM