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.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.1.14 and Lurgle.Alerting v1.1.9 Released

I've pushed out updates to Lurgle.Logging and Lurgle.Alerting today. The Lurgle.Logging update is minor - I noticed that Log.Add wasn't correctly passing the calling method, source file, and line number. Lurgle.Alerting has received a more substantial update: This helps to make Lurgle.Alerting even more useful and reliable! You can get...

Lurgle.Logging - a standardised Serilog implementation with extra goodies!

Logging is important Logging is a really important, oft-neglected, aspect of business applications. I can't state that enough. If you don't have good logging, you can't troubleshoot and debug problems, and you have little chance of seeing what's actually going on in your enterprise. In Structured Logging with Seq and Serilog,...