2019-08-12 Logstash 收集多个日志文件存放到不同索引中

在logstash配置文件中,可以使用不同的type指定每个输入。
然后在过滤器中可以使用if来区分不同的处理,
并且在输出端可以使用“if”输出到不同的目的地。

input {
    file {
            type => "technical"
            path => "/home/technical/log"
    }
    file {
            type => "business"
            path => "/home/business/log"
    }
} 
filter {
    if [type] == "technical" {
            # processing .......
    }
    if [type] == "business" {
            # processing .......
    }
}
output {
    if [type] == "technical" {
            # output to gelf
    }
    if [type] == "business" {
            # output to elasticsearch
    }
}

参考(https://codeday.me/bug/20170716/38088.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容