Save redis channel name inside document

Hi,

I have logstash pipeline like:

input {

    redis {
        host=> "redis-endpoint.com"
        port => "6379"
        key => "*"
        data_type => "pattern_channel"
        batch_count => 100
        codec => "json"
    }

}

output {

    elasticsearch{
        hosts=>["localhost:9200"]
        index=>"channel_name"
    }

}

Inside input plugin I use data_type => "pattern_channel" and key => "*"
Is there a way to get channel name ?

I need to write document in an index which named with channel_name.
We have a lot of channel and i cannot set it with hard code

Thanks a lot

The code adds the channel name as [@metadata][redis_channel], so you can use a sprintf reference to that for the output index option.

1 Like

Solved my problem

Thank you so much