Compare a field with a csv file and add info from csv in a new field

If file.csv contains

11,home
12,garden
13,office

then this configuration

input { generator { count => 1 lines => [ '' ] } }

filter {
    mutate { add_field => { "id" => "12" } }
    translate {
        field => "[id]"
        destination => "[location]"
        dictionary_path => '/home/file.csv'
        refresh_interval => '1000'
    }
}
output { stdout { codec => rubydebug { metadata => false } } }

will produce

  "location" => "garden",
        "id" => "12",

Your filter should work as is.

1 Like