Serilog to Amazon S3 (edit)

Convert JSON to C# Online - Json2CSharp

Serilog Best Practices - Ben Foster (HAY HAY HAY)

Standard log properties

Standardising log event properties enables you to get the most out of log search and analysis tools. Use the following Properties where applicable:

ApplicationName The name of the application generating the log events
ClientIP The IP address of the client from which a request originated
CorrelationId An ID that can be used to trace the request across multiple application boundaries
Elapsed The time in milliseconds an operation took to complete
EventType A hash of the message template used to determine the message type
MachineName The name of the machine on which the application is running
Outcome The outcome of an operation
RequestMethod The HTTP request method e.g. POST
RequestPath The HTTP request path
SourceContext The name of component/class from which the log originated
StatusCode The HTTP response status code
UserAgent The HTTP user agent
Version The version of the running application

Many of the above attributes come from Serilog’s own extensions, for example Serilog Timings (used to time operations) and Serilog request logging.

Writing logs to Elasticsearch with Fluentd using Serilog in ASP.NET Core (andrewlock.net) (HAY HAY HAY)

{
  "@t": "2018-05-17T10:23:47.0727764Z",
  "@mt": "{HostingRequestStartingLog:l}",
  "@r": [
    "Request starting HTTP\/1.1 GET http:\/\/localhost:5000\/  "
  ],
  "Protocol": "HTTP\/1.1",
  "Method": "GET",
  "ContentType": null,
  "ContentLength": null,
  "Scheme": "http",
  "Host": "localhost:5000",
  "PathBase": "",
  "Path": "\/",
  "QueryString": "",
  "HostingRequestStartingLog": "Request starting HTTP\/1.1 GET http:\/\/localhost:5000\/  ",
  "EventId": {
    "Id": 1
  },
  "SourceContext": "Microsoft.AspNetCore.Hosting.Internal.WebHost",
  "RequestId": "0HLDRS135F8A6:00000001",
  "RequestPath": "\/",
  "CorrelationId": null,
  "ConnectionId": "0HLDRS135F8A6"
}

AWS examples in C# – structured logging in .NET Core and AWS Lambda – Automation Rhapsody

AWS examples in C# – working with SQS, DynamoDB, Lambda, ECS – Automation Rhapsody

{
  "@timestamp": "2018-05-17T22:31:43.9143984+12:00",
  "level": "Information",
  "messageTemplate": "{HostingRequestStartingLog:l}",
  "message": "Request starting HTTP\/1.1 GET http:\/\/localhost:5000\/  ",
  "fields": {
    "Protocol": "HTTP\/1.1",
    "Method": "GET",
    "ContentType": null,
    "ContentLength": null,
    "Scheme": "http",
    "Host": "localhost:5000",
    "PathBase": "",
    "Path": "\/",
    "QueryString": "",
    "HostingRequestStartingLog": "Request starting HTTP\/1.1 GET http:\/\/localhost:5000\/  ",
    "EventId": {
      "Id": 1
    },
    "SourceContext": "Microsoft.AspNetCore.Hosting.Internal.WebHost",
    "RequestId": "0HLDRS5H8TSM4:00000001",
    "RequestPath": "\/",
    "CorrelationId": null,
    "ConnectionId": "0HLDRS5H8TSM4"
  },
  "renderings": {
    "HostingRequestStartingLog": [
      {
        "Format": "l",
        "Rendering": "Request starting HTTP\/1.1 GET http:\/\/localhost:5000\/  "
      }
    ]
  }
}