Logging ServiceStack requests with Seq

Logging ServiceStack requests with Seq

Following on from my last post where I used a serilog enricher for servicestack exceptions I wanted to log all requests in a ServiceStack AppHost to Seq.


If you don't know what seq is, it is described on their site as follows:

Seq is the easiest way for .NET developers to capture, search and integrate structured log events

Basically this means your apps can send rich log data to seq and have a really great experience around searching and filtering.


ServiceStack provides this functionality in the RequestLogsFeature plugin, which by default creates an in-memory history of the last 1000 requests or optionally can be persisted using Redis.

If I can instead log these requests to Seq where all my apps log to, I can better track the flow of requests from applications to my API's.

With the RequestLogsFeature as my starting point I've created a plugin which logs requests to an instance of Seq. It does this by posting over HTTP/S to Seq.

The source is available on GitHub. You can also find it on nuget as ServiceStack.Seq.RequestLogsFeature.


In your AppHost add the plugin and specify your seq url and optional apiKey.

public override void Configure(Container container)  
  // Config examples
  Plugins.Add(new SeqRequestLogsFeature("http://localhost:5341", "seq-api-key"));

That's it. Simples!

You can optionally configure the same options the native request logger has, such as logging response bodies, session tracking etc and it shares all the same defaults.

Message template

Seq uses message templates to generate 'uniqueness' for types of requests.
For the RequestLogger I used the http://server/request/path ignoring querystrings to define my requestTypes on seq.

This hopefully provides a good way of filtering the logs by the server and service method called.

Logging levels

  • All 400-499 http status codes are logged as Warnings
  • All 500 > http status codes are logged as Errors
  • All other requests are logged as Info


Unlike the native request logger, which uses AppHost roles, you control logging permission using api keys and read permissions to those logs via Seq users, Both local and active directory users are supported.

The other native logger defaults have been kept but if you are logging any potentially sensitive information, you should also consider configuring ssl on your Seq instance to ensure the seq post requests are encrypted.

Log Retention

Again unlike the native request logger, seq has it's own retention policies which give you fine control over which logs to keep and for how long.


I've created two different versions. For ServiceStack version 3.x, use the v3.x of the nuget package. For ServiceStack v4.x, use ... you guessed it, the v4.x version of the nuget package.

Bugs + Requests

Log any bugs and feature requests to github or submit a pull request if you're able.

Wrapping up

In one line of code in your AppHost you can now log all you api's requests to Seq.

ServiceStack exception enricher for Serilog

ServiceStack exception enricher for Serilog

I've been using serilog recently and its proving to be extremely useful and easy to use. One of the nice features of serilog is enrichers. They allow you add properties to your log events. You can find out more about them here

An application I was troubleshooting the other day was getting a WebServiceException from a servicestack api request, the stacktrace was added to my logging events but it wasn't that easy to find the relevant exception information.

This is the perfect use-case for an enricher, so I wrote one. This allowed me to map the exception properties as log event properties in my structured logevent data.

To add this to your log config is as easy as

\\ using serilog;
var log = new LoggerConfiguration()  

Now I can see and search for all those exception properties in my log sinks.

Perfect! :)