elasticsearch 如何在logstash conf文件中使用include?,elasticsearch,logstash,filebeat,elasticsearch,Logstash,Filebeat" /> elasticsearch 如何在logstash conf文件中使用include?,elasticsearch,logstash,filebeat,elasticsearch,Logstash,Filebeat" />

elasticsearch 如何在logstash conf文件中使用include?

elasticsearch 如何在logstash conf文件中使用include?,elasticsearch,logstash,filebeat,elasticsearch,Logstash,Filebeat,可以在日志存储配置文件中使用includes吗 最小、完整且可验证的示例 我能换这个吗 文件:beats.conf …用这个 文件:date.inc 文件:beats.conf 输入{ 击败{ 端口=>5044 } } 滤器{ #包括//[“localhost:9200”] } } 实际上不支持“include”,Logstash无法加载分割在不同文件中的管道以重用公共部分。 编辑:从不同文件组成管道的唯一方法是在path.config设置中指定文件夹或通配符“*”,以便按照字母顺序读取配置文件

可以在日志存储配置文件中使用includes吗

最小、完整且可验证的示例

我能换这个吗

文件:beats.conf

…用这个

文件:date.inc

文件:beats.conf

输入{
击败{
端口=>5044
}
}
滤器{
#包括//[“localhost:9200”]
}
}

实际上不支持“include”,Logstash无法加载分割在不同文件中的管道以重用公共部分。 编辑:从不同文件组成管道的唯一方法是在
path.config
设置中指定文件夹或通配符“*”,以便按照字母顺序读取配置文件(感谢@Badger)

如果您不想定义自己的管道的合成/编译系统,您可以查看“管道到管道”的通信,该通信可用于分解复杂的管道,并在不同的流上重用过滤器:。注意,使用这种方法,您将支付运行多个管道的开销

例如:

管道。yml

- pipeline.id: input
  path.config: "<path-to-file>/beats.conf"
- pipeline.id: date-filters
  # This common pipeline allow to reuse the same logic for complex filters
  path.config: "<path-to-file>/date.conf"
- pipeline.id: output
  path.config: "<path-to-file>/elasticsearch.conf"
date.conf

input {
  beats {
    port => 5044
  }
}
output { pipeline { send_to => [commonFilters] } }
input { pipeline { address => commonFilters } }
filter {
  date {
    match => ["myTimestamp", "yyyyMMdd_HH:mm:ss.SSS"]
    target => "date_time"
  }
}
output { pipeline { send_to => [output] } }
input { pipeline { address => output } }
output {
  elasticsearch {
    hosts => [ "localhost:9200" ]
  }
}
elasticsearch.conf

input {
  beats {
    port => 5044
  }
}
output { pipeline { send_to => [commonFilters] } }
input { pipeline { address => commonFilters } }
filter {
  date {
    match => ["myTimestamp", "yyyyMMdd_HH:mm:ss.SSS"]
    target => "date_time"
  }
}
output { pipeline { send_to => [output] } }
input { pipeline { address => output } }
output {
  elasticsearch {
    hosts => [ "localhost:9200" ]
  }
}

说Logstash无法加载在不同文件中拆分的管道是不正确的。您可以将path.config指向一个通配符,它将加载所有匹配的文件作为同一管道的一部分。