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

Use Serilog's Compact JSON format for the "Raw JSON" download #460

Closed
nblumhardt opened this issue Aug 17, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@nblumhardt
Copy link
Member

commented Aug 17, 2016

When downloading the "Raw JSON" for an event in the UI:

image

The Seq API's "event entity" format is returned, which is useful for the Seq UI but not supported or useful elsewhere:

{
  "Timestamp": "2016-07-27T11:54:31.7815796+10:00",
  "Properties": [
    {
      "Name": "TaxAmount",
      "Value": 10.945
    },
    {
      "Name": "MachineName",
      "Value": "XMPWEB-01"
    },
    <snip>
  ],
  "MessageTemplateTokens": [
    {
      "Text": "Pre-discount tax total calculated at $"
    },
    {
      "PropertyName": "TaxAmount",
      "FormattedValue": "10.95"
    }
  ],
  "EventType": "$A26D9943",
  "Level": "Information",
  "Id": "event-f3c9e7f4b5c008d33550220000000000",
  "Links": {
    "Self": "api/events/event-f3c9e7f4b5c008d33550220000000000{?download,render,clef}",
    "Group": "api/events/resources"
  }
}

Since Serilog has defined a new compact JSON log event format intended to be broadly useful, the download link could return it instead:

{"@t":"2016-07-27T01:54:31.7815796Z",
 "@mt":"Pre-discount tax total calculated at ${TaxAmount:0.00}",
 "@m":"Pre-discount tax total calculated at $10.95",
 "@i":"a26d9943",
 "@r":["10.95"],
 "TaxAmount":10.945,
 "MachineName":"XMPWEB-01",
 "RequestId":"1303bd22-bab5-417f-ba76-7bc9a3c81fbd",
 "SourceContext":"ECommerceSite.Actors.Customer",
 "ThreadId":6.0,
 "Application":"e-Commerce",
 "SerialNumber":1106.0}

The format defines a payload as newline-separated JSON documents, so we'll probably be best off respecting that here rather than pretty-printing as in the older format.

@nblumhardt nblumhardt added this to the 3.3-pre milestone Aug 17, 2016

@nblumhardt

This comment has been minimized.

Copy link
Member Author

commented Aug 17, 2016

Done.

@nblumhardt nblumhardt closed this Aug 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.