Search code examples
elasticsearchkibanafilebeat

Filebeat 7.9.3 change index is not working and it always creates default filebeat-7.9.3-2020.11.04-000001


I tried this https://www.elastic.co/guide/en/beats/filebeat/master//change-index-name.html#change-index-name and https://discuss.elastic.co/t/index-management-change-index-name-in-filebeat/202876

with filebeat-7.9.3 and kibana-7.9.2 in windows environment .However in Kibana it doesn't create the indexname that I mentioned in filebeat.yml

# ============================== Filebeat inputs ===============================

filebeat.inputs:
- type: log
    - C:\FREESOFT\myfilebeatlogs\*


# ============================== Filebeat modules ==============================

filebeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: false

# ======================= Elasticsearch template setting =======================

setup.template.settings:
  index.number_of_shards: 1
  #index.codec: best_compression
  #_source.enabled: false

# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]
index: "customindexname-%{+yyyy.MM.dd}"

Also I tried with

index: "myindexname-%{+yyyy.MM.dd}"
setup.template.enabled: false
setup.template.name: "myindexname"
setup.template.pattern: "myindexname-*"

Kindly help me with this ,I want to create a custom index and insert data to it from Filebeat. The past questions in stack didn't solve my problm.


Solution

  • Below config works for me and create a index name which I want

    filebeat.inputs:
      - type: log
        paths:
          - "/var/log/*.log"
    setup.ilm.enabled: false
    setup.template.overwrite: true
    output.elasticsearch:
      hosts: ["<my-es-host>"]
      index: "foo-%{+yyyy.MM}"
      username: '${ELASTICSEARCH_USERNAME:elastic}'
      password: '${ELASTICSEARCH_PASSWORD:elastic}'
    
    setup.template:
      name: 'foo'
      pattern: 'foo-*'
      enabled: false