首页 > 解决方案 > 如何在logstash的.conf文件中创建多个索引

问题描述

我使用了以下 .conf 文件,但它给了我一个错误。我的想法是在过滤器中添加更多条件,以便根据 csv 文件获得多索引。

input {
      file {
        path => "/home/aitor/RETO8/*.csv"
        start_position => "beginning"
        sincedb_path => "/dev/null"
      }
    }
filter {
      if [path] =~ "df_actualizado.csv" {
        mutate { replace => { type => "apache_access" } }
    
    
  csv {
      separator => ","
      skip_header => "true"
      columns => ['Smart_Meter_1', 'Smart_Meter_2', 'Smart_Meter_3',
       'Smart_Meter_4', 'Smart_Meter_5', 'Smart_Meter_6', 'Smart_Meter_7',
       'Smart_Meter_8', 'Smart_Meter_9', 'Smart_Meter_10', 'Smart_Meter_11']
  }
}

  output {
   elasticsearch {
     hosts => "http://localhost:9200"
     index => "%{type}_indexer"
  }

stdout {}

}

标签: elasticsearchlogstashlogstash-file

解决方案


似乎您在 if 语句后缺少括号,导致它保持打开状态。


推荐阅读