Assign a value if field has no value present

I am gone a read a csv formated file which has more then 50 field,
by default I want to assign a value "UNKNOWN" to any blank field. how do I easily do it ?

on smaller files I have done
if ![var1] { mutate {update......

but for this long if there is a way to do it for all.

You could try

    ruby {
        init => '
            Columns = [ "C1", "C2" ]
        code => '
            Columns.each { |k|
                unless event.get(k)
                    event.set(k, "UNKNOWN")

can you explain what is columns = ["c1" , "c2"] is doing?

Those would be the names of the columns in the CSV file, that is, the set of fields that you want to set to unknown if they are not present in the CSV. I should have mentioned that you will want to set skip_empty_columns on the csv filter so that the fields do not get created if they are empty.

perefect I will give this a try next week.

Worked. just had to put longgg columns list, alll empty field has value now.