External configuration rules
Prerequisites:
Install configuration module
Read about log events
Read about source context
Read about filtering
Read about enrichment
ConfigurableLog is essentially a CompositeLog with named components and rules for filtering and enrichment. Rules can be supplied from any external source and support reconfiguration without application restart.
Log configuration rules
Every rule contains some of the following:
Property
Type
Default value
Description
Enabled
bool
true
Enables/disables the logging in scope of the rule entirely.
Log
string
null
Limits the scope of the rule to the log with given name. If not specified, the rule applies to all logs.
Source
string
null
Operation
string
null
MinimumLevel
LogLevel?
null
Sets the minimum log level for the events in scope of the rule.
Properties
Dictionary
null
Adds given set of properties to every event in scope of the rule.
There are also some important points to remember when defining rules:
You should never create two rules with identical scopes (
Log
+Source
+Operation
). Consider merging them instead.Rules without
Log
scope are evaluated before any log-specific rules are considered.When evaluating whether to log an event, the most specific of the matching rules gets to decide.
A rule with
Source
scope is more specific than a rule without any scope.A rule with
Operation
scope is more specific than a rule without any scope.A rule with
Operation
scope is more specific than a rule withSource
scope.A rule with
Source + Operation
scope is the most specific one possible.
Additional properties are added from all matching rules.
Create a ConfigurableLog
Rules can also be supplied with an IObservable<LogConfigurationRule[]>
. Here's an equivalent of the configuration above using Vostok.Configuration library and storing rules in JSON file:
Last updated