zoukankan      html  css  js  c++  java
  • logstash收集系统日志配置

    查看官方文档

    https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html

    找个路径

    /home/data/logstash/logstash/config  

    创建 vi file.config

    input {
        file {
         path => "/var/log/messages"
         type => "system"
         start_position => "beginning"
         }

    ##java的输出日志  使用codec 处理异常信息


       file {
           path => "/home/data/es/logs/oldboy.log"     
           type => "es_error"
           start_position => "beginning"

    ##输出错误日志
           codec => multiline {
             pattern => "^["
             negate => true
             what => "previous"
            }
        }

    }
    output {
       if [type]=="system" {
        elasticsearch {
             hosts => ["192.168.174.130:9200"]
             index => "system-%{+YYYY.MM.dd}"
         }
        }
       if [type]=="es_error" {
         elasticsearch {
              hosts => ["192.168.174.130:9200"]
             index => "es_error-%{+YYYY.MM.dd}"
         }

        }

       


    }

    启动

    bin/logstash -f /home/data/logstash/logstash/config/file.conf

  • 相关阅读:
    MySQL7:性能优化
    MySQL6:视图
    MySQL5:触发器
    MySQL4:索引
    MySQL3:存储过程和函数
    MySQL1:MySQL函数汇总
    MySQL2:四种MySQL存储引擎
    Spring7:基于注解的Spring MVC(下篇)
    Spring6:基于注解的Spring MVC(上篇)
    Linux查看端口号
  • 原文地址:https://www.cnblogs.com/gyadmin/p/10635954.html
Copyright © 2011-2022 走看看