ITPub博客

首页 > IT基础架构 > > LogStash多来源日志收集配置

LogStash多来源日志收集配置

作者:格伯纳 时间:2020-06-01 13:42:19 0 删除 编辑

最近需要做一下K8S的应用内日志收集,试水了一下LogStash的日志收集,下面给大家看一下如何收集多来源的日志。

<pre name="code" class="python">
input {
    file {
        type => "tms_inbound.log"
        path => "/JavaWeb/tms2.wltest.com/logs/tms_inbound.es.*.log"
        codec => json {
                charset => "UTF-8"
            }
    }
 
    file {
        type => "tms_outbound.log"
        path => "/JavaWeb/tms2.wltest.com/logs/tms_outbound.es.*.log"
        codec => json {
                charset => "UTF-8"
            }
    }
}
 
 
 
output {
    
    if [type] == "tms_inbound.log" {
       elasticsearch { hosts => "10.230.3.183:9200"
                        index =>  'tms_inbound.log-%{+YYYY.MM.dd}'
                        codec => "json" }
        }
    else{
      elasticsearch { hosts => "10.230.3.183:9200"
                        index => 'tms_outbound.log-%{+YYYY.MM.dd}'
                        codec => "json" }
        }
 
}

总结一下,也就是我们需要赔多个Input,然后再根据不同Input的Type来配置不同的导出方式。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31509949/viewspace-3142155/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: MySQL 删除数据表
请登录后发表评论 登录
全部评论
管理员

注册时间:2018-03-30

  • 博文量
    2383
  • 访问量
    983938