How can i replace multiple special characters in all fields?

Ç => Ç

ç => ç

Ş => Ş

ş => ş

İ => İ

ı => ı

Ü => Ü

ü => ü

Ö => Ö

ö => ö

Ğ => Ğ

ğ => ğ

I want to replace these characters in all fields. how can I do it?

If it is a fixed set of fields you could do it in a mutate filter. If you really want to do it to all fields and you do not know what those fields will be you would have to use ruby

    ruby {
        code => '
            event.to_hash.each { |k, v|
                if v.is_a? String
                    event.set(k, v.gsub("Ç", "Ç").gsub("ç", "ç").gsub("Ş", "Ş").gsub("ş", "ş").gsub("İ", "İ").gsub("ı", "ı").gsub("Ü", "Ü").gsub("ü", "ü").gsub("Ö", "Ö").gsub("ö", "ö").gsub("Ğ", "Ğ").gsub("ğ", "ğ"))
                end
            }
        '
    }

If you want to handle more HTML entities you might be better off rewriting that loop to use something like htmlentities. If you need to handle fields nested in objects you would have to write a recursive function. There is an example of walking through all fields in an event here.

1 Like

Thank you for the answer. I tried it and it worked very well. I will add other codes to this ruby ​​code. I couldn't write because I don't know ruby. I will look into the links you sent. Thank you very much again.

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