zoukankan      html  css  js  c++  java
  • logstash 配置文件备份

    input{
            kafka {
                    bootstrap_servers => "127.0.0.1:9092"
                    client_id => "nginxaccesslog"
                    auto_offset_reset => "latest"
                    consumer_threads => 5
                    decorate_events => true
                    topics => ["nginx_access_log"]
                    codec => "json"
                    type => "nginx_log"
            }
            kafka {
                    bootstrap_servers => "127.0.0.1:9092"
                    client_id => "database"
                    auto_offset_reset => "latest"
                    consumer_threads => 5
                    decorate_events => true
                    topics => ["dsideal_db"]
                    codec => "json"
                    type => "dsideal_db"
            }
            kafka {
                    bootstrap_servers => "127.0.0.1:9092"
                    client_id => "devops_real"
                    auto_offset_reset => "latest"
                    consumer_threads => 5
                    decorate_events => true
                    topics => ["devopsrealinfo"]
                    codec => "json"
                    type => "devopsrealinfo"
            }
            kafka {
                    bootstrap_servers => "127.0.0.1:9092"
                    client_id => "devops_base"
                    auto_offset_reset => "latest"
                    consumer_threads => 5
                    decorate_events => true
                    topics => ["devopsbaseinfo"]
                    codec => "json"
                    type => "devopsbaseinfo"
            }
    }
    filter{
            mutate {
                    gsub => ["message", "\x22", '"']
                    gsub => ["message", "\x09", '']
        }
        json {
            source => "message"
            remove_field=>["message","beat","@version","@timestamp"]
        }
            if [type] == "nginx_log" {
                    ruby {
                            code => '
                                    file = File.open("/usr/local/logstash/config/white.txt", "r")
                                    text = file.read
                                    file.close
    
                                    if !text.include?(event.get("request_uri")) then
                                            event.set("es_flag","0")
                                    else
                                            event.set("es_flag","1")
                                    end
    
                            '
                    }
            }
    
    }
    
    output {
            if [type] == "nginx_log" {
                    if [es_flag] =="1" {
                            elasticsearch {
                                    hosts => "127.0.0.1:9200"
                                    index => "nginx-access-log"
                            }
                    }
                    else {
                            elasticsearch {
                                    hosts => "127.0.0.1:9200"
                                    index => "nginx-access-log-other"
                            }
                    }
            }
            if [type] == "dsideal_db" {
                    elasticsearch {
                            hosts => "127.0.0.1:9200"
                            index => "%{table_name}"
                            document_id => "%{id}"
                    }
            }
            if [type] == "devopsbaseinfo" {
                    elasticsearch {
                            hosts => "127.0.0.1:9200"
                            index => "devopsbaseinfo"
                            document_id => "%{id}"
                    }
            }
            if [type] == "devopsrealinfo" {
                    elasticsearch {
                            hosts => "127.0.0.1:9200"
                            index => "devopsrealinfo"
                    }
            }
    }
  • 相关阅读:
    Timed Code
    jQuery的deferred对象详解
    ASP.NET MVC 使用Redis共享Session
    .NET垃圾回收(GC)原理
    强命名程序集,签名,延迟签名
    CLR 关于强命名程序集 .
    .NET程序集强命名删除与再签名技术 源代码剖析
    应用Strong Name保存.NET应用程序集
    使用强命名程序集防范篡改
    1.浅谈CLR
  • 原文地址:https://www.cnblogs.com/kgdxpr/p/12107919.html
Copyright © 2011-2022 走看看