zoukankan      html  css  js  c++  java
  • logstash 处理tomcat catalina.out

    input {
            file {
                    type => "zj_api"
                    path => ["/data01/applog_backup/zjzc_log/zj-api*catalina*"]
                    codec => multiline {
                    pattern => "^s+%{TIMESTAMP_ISO8601}"
                    negate => true
                   what => "previous"
                    }
                }
        
           file { 
                    type => "wj_api" 
                    path => ["/data01/applog_backup/winfae_log/wj-api*catalina*"] 
                      codec => multiline {
                    pattern => "^s+%{TIMESTAMP_ISO8601}"
                    negate => true
                   what => "previous"
                    }
            } 
    
     
    }
    
     filter {
             mutate {
                           add_field => [ "[@metadata][zabbix_key]" , "logstash-api-access" ]
                           add_field => [ "[@metadata][zabbix_host]" , "dr-mysql01" ]
                           add_field =>["messager","%{type}-%{message}"]
                           #remove_field =>["message"]
                    }
    }
    
    
    
    filter {
        grok {
            match => [ "message","(?m)s*%{TIMESTAMP_ISO8601:time}s+(?<Level>(S+)).*"]
         }
         date {
            match => ["time", "yyyy-MM-dd HH:mm:ss,SSS"]
        }
         mutate {
           remove_field =>["message"]
            }
    }
    
    output {
             if ([Level]  == "ERROR" or [messager] =~ "Exception" ) and [messager] !~ "温金服务未连接" and  [messager] !~ "调用温金代理系统接口错误" and [messager] !~ "BusinessException"  {
              zabbix {
    		zabbix_host => "[@metadata][zabbix_host]"
    		zabbix_key => "[@metadata][zabbix_key]"
            zabbix_server_host => "192.168.32.55"
            zabbix_server_port => "10051"
    		zabbix_value => "messager"
            }
           }
         if [type] == "zj_api" { 
            redis {
                    host => "192.168.32.67"
                    data_type => "list"
                    key => "zj_api:redis"
                    port=>"6379"
                    password => "1234567"
            }
    }
          else if [type] == "wj_api"{
           redis { 
                    host => "192.168.32.67" 
                    data_type => "list" 
                    key => "wj_api:redis" 
                    port=>"6379" 
                    password => "1234567" 
            } 
    }
    }
      

  • 相关阅读:
    windows下cmd命令行上传代码到github的指定库
    Navicat Premium 12.1.11.0安装与激活
    windows部署Apollo
    C#事件-使用事件需要的步骤
    C#委托和事件
    C#事件委托概念
    C#中委托和事件的区别
    C#委托与事件
    C#细说多线程
    C# 堆栈(Stack)和队列(Queue)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350176.html
Copyright © 2011-2022 走看看