LogViewPlus Support

JSON Integer

https://www.logviewplus.com/forum/Topic14.aspx

By Email User - 7 Nov 2018

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)?
By LogViewPlus Support - 7 Nov 2018

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