Applications logging events to Seq can provide an API key to identify themselves.
API keys can be used to:
- Tag events with properties allowing them to be inspected and filtered easily
- Authenticate the client application to prevent accidental or unauthorized writes
- View the rate of incoming events from the application
- Filter events on arrival, reducing server load in the case of a runaway application
- If the client supports it, notify the application of its desired logging level to reduce network traffic
The tagging and filtering features of API keys are supported in all Seq editions, but authentication requires a paid Seq license.
API keys are listed, and created, in the Settings > API Keys screen within Seq.
Selecting Add API key will request a name and other details of the key. Here, the properties to apply, filter, and logging level to advertise can be specified.
API key arrival filters can be a very effective way of reducing log noise.
When the API key is saved, its token will be displayed. This is supplied to the client logging library as part of the application's configuration, for example with Serilog:
Log.Logger = new LoggerConfiguration() .WriteTo.Seq("http://my-seq", apiKey: "9fs9V80bjlkgau9adsjH") .CreateLogger();
Events arriving from the application will include any applied properties:
How many API keys should I create?
API keys are an easy way to keep track of where events are coming from, and to filter it accordingly.
In general, every distinct application writing to Seq should have its own API key. If the application is deployed in multiple configurations, using a different key for each configuration is also a good idea.
Updated less than a minute ago