Regarding automapping for json file

Hi, all

Is there any way to disable json's automapping?

I tried to use the template to disable the numeric detection but it does not work.

Since my data has many fields, it does not make sense to change type for each field manually.

Thanks.

Are you saying that you want the JSON to be parsed but everything converted to strings?

1 Like

Hi Badger,

Thanks for the reply.

Yes. I only need one value to be long and the rest to be strings.

So I want to disable the auto mapping.

Here is my logstash input plugin

input {
    file {
        path => "/data/Aggregation_json/all_aggregation.json"
        codec => json
        start_position => "beginning"
        sincedb_path => "/dev/null"
    }   
}

You cannot disable it, but you can iterate over the event in a ruby filter and .to_s everything.

1 Like

Thanks a lot, I will try it.

This might help you understand how to iterate over arbitrary event structures. It solves a different problem (making all keys and values lowercase) but making all values strings is similar enough for it to be useful.

1 Like

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