Skip to content

Instantly share code, notes, and snippets.

@jialechan
Last active December 8, 2016 08:25
Show Gist options
  • Save jialechan/83199d23e0c9be8a8365e226692c1a45 to your computer and use it in GitHub Desktop.
Save jialechan/83199d23e0c9be8a8365e226692c1a45 to your computer and use it in GitHub Desktop.
input {
        redis {
                host => "127.0.0.1"
                type => "redis-A" #原json不能有type关键字,类似的关键字还有index,id,score,source
                port => "6379"
                data_type => "list" # If redis_type is list, then we will BLPOP the key
                db => 0
                key => "palmplay_push_show2"
        }
        redis {
                host => "127.0.0.1"
                type => "redis-B"
                port => "6379"
                data_type => "list" # If redis_type is list, then we will BLPOP the key
                db => 0
                key => "palmplay_push_show"
        }
}

filter {
        date {
                match => [ "time", "UNIX_MS" ]
        }
}

output {
        if [type] == "redis-A"{
                elasticsearch {
                        index => "pp-1-%{+YYYY.MM.dd}"
                        hosts => "127.0.0.1:9200"
                        codec => json
                }
        } else if [type] == "redis-B"{
                elasticsearch {
                        index => "pp-2-%{+YYYY.MM.dd}"
                        hosts => "127.0.0.1:9200"
                        codec => json
                }
        } else {
                elasticsearch {
                        index => "unknown-2-%{+YYYY.MM.dd}"
                        hosts => "127.0.0.1:9200"
                        codec => json
                }
        }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment