Creating a new field based on the input and send it to the output

I have a simple query that fetch data from database through logstash jdbc plugin.
Query : Select emp_id, department_id from employee;
Now I need an addition field department_name in the output.
department_name can be created based on department_id and simple logic (
if ( department_id = '1') {
department_name = "ABC"
} else if ( department_id = '2') {
department_name = "DEF
} else if ( department_id = '3') {
department_name = "GHI"
}

How to achieve this?

You could use an if-else like that and use mutate+add_field, or you could use a translate filter.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.