logStash收集日志并存储到Elasticsearch

上一节说道如何用logStash收集日志,结合Elasticsearch 进行日志收集和存储 logStash配置以下apache

input {
    file {
        path => "/yang/apache-tomcat-7.0.55/logs/*"   //收集tomcat/logs/目录下全部文件
        start_position => end                        //从文件结尾处收集
    }
}
filter {
      if ([message] =~ "^debug") {     //过滤掉debug开头的信息
             drop {}                    //过滤的信息丢弃掉
          }
}
output {
    stdout { codec => json}
         elasticsearch { hosts =>["http://127.0.0.1:9200"] }    //将日志信息输出到Elasticsearch集群
}

就是这么简单,还有不少细节没有搞定,继续学习json

相关文章
相关标签/搜索