Excluding specific log messages
To make log files smaller and easier to analyze, you can create a log publisher message exclusion policy.
About this task
Log publisher message exclusion policies suppress messages from being logged to specific log publishers. You can create a policy using dsconfig create-log-publisher-message-exclusion-policy
and then assign it to an existing log publisher.
Exclusion policies currently only support error log publishers. You can define exclusion policies for PingDirectory, PingDirectoryProxy, and PingDataSync.
Enabling log message exclusion could cause the server to fail to log important messages. Be as specific as possible when configuring exclusion policies to ensure that you are only suppressing the intended log messages. |
The following table describes the attributes and arguments for creating a log publisher message exclusion policy with dsconfig create-log-publisher-message-exclusion-policy
:
Attribute or argument | Description | Accepted values | Requirement |
---|---|---|---|
|
Specifies the type of log publisher to which the policy applies. |
|
Required |
|
Defines the name of the log message exclusion policy. |
n/a |
Required |
|
Specifies the category of the log message to exclude. |
|
Required |
|
Specifies the severity of the log message to exclude. |
|
Required |
|
Defines the regex string that must match the actual message of the log. |
Any valid regex pattern. |
Required |
|
Specifies whether or not the policy suppresses log messages. |
A value of |
Required |
|
Specifies the ID of the log message to suppress. |
Any positive integer value. If the message ID isn’t declared, then the policy checks for a message ID value of |
Optional |
Steps
-
Create a log publisher message exclusion policy.
Example:
$ bin/dsconfig create-log-publisher-message-exclusion-policy \ --type error \ --policy-name "Test Policy" \ --set "enabled:true" \ --set "log-message-category:LOG" \ --set "log-message-severity:NOTICE" \ --set "log-message-regex:foobar" \ --set "log-message-id:1880555611"
To exclude a log message using this policy, all the attributes of the policy must match the fields of the log message. If they don’t, the log message gets published.
-
Assign the exclusion policy to an existing log publisher using the
log-message-exclusion-policy
attribute.Example:
$ bin/dsconfig set-log-publisher-prop \ --publisher-name “Example Error Log Publisher” \ --set “log-message-exclusion-policy:Test Policy”