JSON extraction

I have a JSON in this format {'messages':'17','values':'20'}, want to parse this json and get key and value seperately
what should be my extractor configuration if i want to extract this key,values.
I have tried all posibilities but it is not working.

Please elaborate on what you want to achieve and provide some examples.

Other than that, please refer to http://docs.graylog.org/en/2.4/pages/extractors.html#using-the-json-extractor.

I get this complete json in message field. I was to extract and make these key and vaues in seperate fields.

Please provide some examples.

FWIW, that’s not valid JSON because of the single quotes.

I push log using https://github.com/severb/graypy to push log to graylog server.


It will be this format in graylog, the json I send from graypy will be in message filed.
now I want to split that fields into key names of my json.
As per my that image my json is {'data':'2','values':'5'} so I want data as 1 field and values as another filed and those fileds have thieir values respectively, like this

level
7

line
3

message
{'data':'2','values':'5'}

pid
26761

data
2

values
5

That’s no valid JSON but a text representation of a Python dictionary.

You could try to use the key_value() function to parse that after removing the surrounding brackets, but that will only work for flat dictionaries.

Ideally, you would set custom attributes in graypy when sending that kind of data.

Will there a option in extactor for key_value() parse ?


I couldnt find in my extractior list.

The key_value() function can be used with Pipeline rules:
http://docs.graylog.org/en/2.4/pages/pipelines.html

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