zoukankan      html  css  js  c++  java
  • elk文件

    =================正则匹配
    [root@web02 conf.d]# cat apache-grok.conf 
    input{
      file {
        path => "/var/log/httpd/access_log"
        type => "apache_access.log"
        start_position => "beginning"
      }
    }
    
    filter {
      if [type] == "apache_access.log" {
        grok {
          match => {"message" => "%{COMBINEDAPACHELOG}" } # 内置httpd正则
          }
      }
    }
    
    output{
    	 if [type] == "apache_access.log" {
             	elasticsearch {
          			hosts => ["10.0.0.18:9200"]
          			index=> "apache_access-%{+YYYY-MM}"
        		}
      	}
    	stdout {
    		codec => rubydebug
    	}
    }
    ==============================
    [root@web02 conf.d]# cat grok.conf 
    input {
    	stdin {
    
    	}
    }
    
    
    filter {
    	grok {
    		 match => { "message" => "%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}" }
    	}
    
    
    }
    
    
    output {
    
    	stdout {
    		codec => rubydebug
    	}
    
    }
    =========================
    [root@web02 conf.d]# cat httpd_redis.conf 
    input {
    	file {
    
    		path => "/var/log/httpd/access_log"
    		start_position => "beginning"
    	}
    
    
    }
    
    output {
    	redis {
    		host => "10.0.0.18"
    		port => "6379"
    		db => "6"
    		data_type => "list"
    		key => "demo"
    
    	}
    
    }
    ============================
    [root@web02 conf.d]# cat nginx.conf 
    input {
    	file {
    		path => "/var/log/nginx/access_log_jason.log"
    		codec => "json"
    		type => "nginx-access-log"
    	}
    
    
    }
    
    
    filter {
    
    
    
    }
    
    
    output {
    	elasticsearch {
    		hosts => ["10.0.0.18:9200"]
    		index => "nginx-access-log-%{+YYYY.MM.dd}"
    
    	}
    	stdout{
    		codec => rubydebug
    	}
    
    }
    ======================
    
    
    [root@web02 conf.d]# cat redis.conf 
    input {
    	stdin {
    
    	}
    
    
    }
    
    
    
    filter {
    
    
    
    }
    
    output {
    	redis {
    
    		host => "10.0.0.18"
    		port  => "6379"
    		db => "6"
    		data_type => "list"
    		key => "demo"
    	}
    
    
    
    }
    

     

  • 相关阅读:
    消息队列学习
    php加密技术
    mysql 数据库优化
    mysql 数据库设计
    mysql 存储引擎
    用python计算圆周率并用进度条并显示计算进度
    关于Turtle库的学习笔记
    Python第一周作业使用turtle库绘图
    turtle绘图的例子
    六边形的绘制
  • 原文地址:https://www.cnblogs.com/gaoyuechen/p/8361635.html
Copyright © 2011-2022 走看看