Lurgle.Logging adds AWS Cloudwatch support

It's been a while since I've added functionality to Lurgle libraries, but I played around with adding AWS Cloudwatch support to Lurgle.Logging. This affords further opportunities to use Lurgle.Logging as a common logging library with all its 'baked in' benefits. To do this, I leveraged the 'official' AWS.Logger.Serilog sink. Puzzlingly, it looks like this might not support use via proxy servers, but otherwise I'm quite happy with it. 

As with all of the logging targets, there are two ways to readily configure this;

1. Using app.config values to enable the Aws sink and then configuring the relevant values. As a rule, LogAwsLogGroup and LogAwsRegion are mandatory. 

<add key="LogType" value="Console,File,Aws" />

<add key="LogLevelAws" value="Verbose"/>

    <!--== AWS Cloudwatch configuration-->
    <add key="LogAwsProfile" value = "" />
    <add key="LogAwsProfileLocation" value=""/>
    <!-- Only use AWS Key and Secret for testing - best practice to use the AWS Profile -->
    <add key="LogAwsKey" value="" />
    <add key="LogAwsSecret" value="" />
    <!-- Required to direct logs to the correct log group and region -->
  <add key="LogAwsLogGroup" value="Blah" />
  <add key="LogAwsRegion" value="us-east-1" />
    <add key="LogAwsCreateLogGroup" value="true" />
    <!-- Optional stream prefix and suffix-->
    <add key="LogAwsStreamPrefix" value=""/>
    <add key="LogAwsStreamSuffix" value=""/>

2. Using a constructor

Logging.SetConfig(new LoggingConfig(Logging.Config, logAwsLogGroup: "Blah", logAwsRegion: "us-east-1", logAwsCreateLogGroup: true));

As a rule of thumb, LogAwsLogGroup and LogAwsRegion should be treated as mandatory.

You should use the LogAwsProfile method of providing credentials per Configure AWS credentials - AWS SDK for .NET (, rather than the LogAwsKey/LogAwsSecret keys. These configuration keys exist only for testing purposes - don't use them in production.

For output, I diverged from using the compact JSON format that Serilog defaults to, and used a rendered JSON format that results in output like this:


AWS JSON output

This preserves the structured properties that are output by Lurgle.Logging, but accomodates the lack of message template coverage in Cloudwatch.

This results in Cloudwatch's ability to return the properties in Logs Insights, for example:


Selecting properties via Insights

Which should then translate through any functionality that can leverage the properties.

This is a fairly straightforward addition that seems to work quite happily. We can iterate further on this if it proves necessary - but I'm certainly happy to have this up and running.

This is available on Nuget now!



You may also like:

Lurgle.Logging v1.2.1 - More logging patterns for your Lurgle convenience

Lurgle approach compared to Serilog Following on from the v1.2.0 multi-threaded correlation release, I thought about whether we could further improve how we interface with Lurgle.Logging. The general approach was to maintain a static interface to logging that would allow us to capture key properties for logging, that would provide nicely...

Lurgle.Alerting v1.1.10 and Lurgle.Logging v1.1.15 Released

I've just pushed out an update to Lurgle.Alerting on Nuget. This release adds a Handlebars template option, based on the implementation by Matthew Turner at FluentEmail.Handlebars ( When I came across the FluentEmail.Handlebars package, I was keen to use it, but it was only compiled against .NET Standard 2.1, and...

Lurgle.Logging v1.2.0 - Multi-threaded correlation ids are now a thing

Multi-threaded correlation ids were not a thing Following on from my work on Seq.Client.WindowsLogins and the subsequent realisation that EventLog's EntryWritten event handler is bad and should feel bad, I contemplated whether I could apply some of my efforts to solve another issue that had been bugging me. Lurgle.Logging was...