JSON Integer


Author
Message
Email User
Email User
Gaining Respect (189 reputation)Gaining Respect (189 reputation)Gaining Respect (189 reputation)Gaining Respect (189 reputation)Gaining Respect (189 reputation)Gaining Respect (189 reputation)Gaining Respect (189 reputation)Gaining Respect (189 reputation)Gaining Respect (189 reputation)
Group: Forum Members
Posts: 36, Visits: 106
I have a JSON log file. One field is an integer, level. This represents the loglevel (i.e. 50 means this was an error).

I am trying to figure out if the JSON parser is able to parse this field. It seems that JSON parser expects all of the fields to be of string type (at least that's based on the examples on this site). Can you please verify if it is at all possible to parse this field and have it output its corresponding loglevel as a string (i.e. ERROR, INFO, etc)?

Edited 6 Years Ago by Email User
LogViewPlus Support
LogViewPlus Support
Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)
Group: Moderators
Posts: 1.1K, Visits: 3.7K
Hi,

Thanks for getting in touch. 

The first thing you need to do is get the priority value parsed. You can do this will a specifier like ‘%s{Level}’. This specifier is literally a string so will need to be declared as a string – but this will not prevent LogViewPlus from reading the integer value correctly from the log entry.

That alone will give you a pretty good parse with the priority number showing up in a ‘Level’ column which can then be search, sorted and filtered.

The next problem will be converting your numeric type into a known LogViewPlus priority. Unfortunately, there is currently no easy way to do this, but you can write a custom post processor which can convert the Level into a known LogViewPlus priority:
https://www.logviewplus.com/docs/post_processors.html

Hope that makes sense. Please let me know if you have any further questions or issues.

Thanks,

Toby

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Login

Explore
Messages
Mentions
Search