Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing Logs With JSON and Non-JSON Payloads #157

Open
kieronlanning opened this issue Aug 21, 2020 · 1 comment
Open

Parsing Logs With JSON and Non-JSON Payloads #157

kieronlanning opened this issue Aug 21, 2020 · 1 comment

Comments

@kieronlanning
Copy link

Hi,

I've rather a complex log that I can't change the format of that I'm hoping to parse for some analysis.

Each record looks a little like this:

$>{***DATETIME***} {***LEVEL***}: {***CLASS***}: {***LINE***}  {***Method***}
{***PROPERTY-NAME***}: {***GUID/STRING/INT***}
{***COLLECTIONAME***}:
  {***PROPERTY-NAME***}: {***GUID/STRING/INT***}
  {***PROPERTY-NAME***}: {***GUID/STRING/INT***}
  {***PROPERTY-NAME***}: {***GUID/STRING/INT***}
{*** MULTILINE OR SINGLELINE COMPLEX JSON ***}

The start of the record is always marked by a $>, but the combination of properties, collections and JSON payloads are all optional.

It's all working apart from the JSON part, which I'm only really interested in as a string value, rather than doing anything with it at this stage.

My issue seems to be getting it to stop parsing - it will continue parsing into the next record, instead of correctly detecting a new record.

In my tests if I remove the JSON payload from the logs, it will process all combinations of records without an issue.

Here's an example JSON payload (with bearer tokens and GUIDs replaced):

{
	"@odata.type": "#microsoft.graph.commsNotifications",
	"value": [{
		"@odata.type": "#microsoft.graph.commsNotification",
		"changeType": "deleted",
		"resourceUrl": "/communications/calls/guid",
		"resource": "/app/calls/guid",
		"resourceData": {
			"@odata.type": "#microsoft.graph.call",
			"state": "terminated",
			"resultInfo": {
				"@odata.type": "#microsoft.graph.resultInfo",
				"code": 200,
				"subcode": 0,
				"message": "This conversation has ended as only one participant was remaining in the conversation. DiagCode: 0#5010"
			},
			"meetingInfo": {
				"@odata.type": "#microsoft.graph.tokenMeetingInfo",
				"token": "bearer-token"
			},
			"callChainId": "guid",
			"id": "guid"
		}
	}]
}
@johngit22
Copy link

johngit22 commented Aug 21, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants