Can't get JSON working


Author
Message
jpooley_hearst
jpooley_hearst
New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)
Group: Forum Members
Posts: 5, Visits: 16
Hi, 

I've got a pretty basic JSON log file and I can't figure out how to get the Parser Wizard to not combine the entire file into a single line.

I've removed every element except for the element I'm using for the Date Time so my parser just looks like this at this point:

{
  "creationTime": "%d{Elapsed}",
 
}


The file as a whole looks like this (sanitized):

[{"id":"20230912-1300258590-00015-83784","creationTime":1694523625859,"resolvedTime":null,"acknowledgedBy":null,"scheduleFixTime":null,"scheduleFixInstruction":null,"lastUpdateSequence":49534,"assertionDetails":[{"labels":[],"state":"TRANSIENT","assertTime":1694523625857,"remitTime":0,"message":"Logo Insertion is disabled according to schedule. "}]}, ... ]


Any suggestions?
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
Is your log file one line of text? 

I think the problem might by that you have an array of log entries and LogViewPlus is struggling to determine where one line ends and the next begins.  LogViewPlus expects at most one log entry per log line.

If you were to add new lines manually between the log entries LogViewPlus should be able to parse the file.  This might help with determining if this is the issue.
Edited 7 Months Ago by LogViewPlus Support
jpooley_hearst
jpooley_hearst
New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)
Group: Forum Members
Posts: 5, Visits: 16
Hi yes when I open the JSON file with Notepad ++ it shows only 1 line

But TBH this is what I would expect from a JSON file

I'd have to go write a Python script to figure out where each item in the list [] starts and ends to add a newline, as one of the elements of each entry is in itself a list [] which will contain commas so it's not as simple as find and replace commas with a newline

Is it possible that more advanced JSON support could become a feature request? I can email in this log file if you want an example.

Although I am even more confused because according to this page LogViewPlus should already support this https://www.logviewplus.com/docs/json_parser.html
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
Usually log files are written one line at a time.  In this case, your whole log file appears to be written all at the same time.  

In other words, most json log files are not actually valid json.  The individual log entries represent valid JSON, but not the whole file.  In your case, the whole file is one big json block.

So this is an unusual use case for us.  At a minimum, I will update the documentation to reflect this.  I would prefer to fix the underlying issue, but this may not be possible.  The relationship between log line / log entry is assumed in multiple places.

In the meantime, if you are familiar with Python, you may be able to pretty print the log file before opening it.  This could be done as an open action.

Thanks for bringing this issue to our attention.

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