---
title: Excluding specific log messages
description: To make log files smaller and easier to analyze, you can create a log publisher message exclusion policy.
component: pingdirectory
version: 11.0
page_id: pingdirectory:pingdirectory_server_administration_guide:pd_ds_exclude_log_messages
canonical_url: https://docs.pingidentity.com/pingdirectory/11.0/pingdirectory_server_administration_guide/pd_ds_exclude_log_messages.html
revdate: June 14, 2024
section_ids:
  about-this-task: About this task
  steps: Steps
  example: Example:
  example-2: Example:
---

# 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 |
| ---------------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `--type`               | Specifies the type of log publisher to which the policy applies.        | `error`                                                                                                                                                                                                                                                                                                                                            | Required    |
| `--policy-name`        | Defines the name of the log message exclusion policy.                   | n/a                                                                                                                                                                                                                                                                                                                                                | Required    |
| `log-message-category` | Specifies the category of the log message to exclude.                   | `CORE, EXTENSIONS, PROTOCOL, CONFIG, LOG, UTIL, SCHEMA, PLUGIN, JEB, BACKEND, TOOLS, TASK, ACCESS_CONTROL, ADMIN, REPLICATION, VERSION, QUICKSETUP, ADMIN_TOOL, DSCONFIG, USER_DEFINED, EXAMINER, SYNC, PROXY, UPDATE, CONSOLE, CONSOLE_TOOLS, COMMON, METRIC, ID_SERVER, MONITORING, AUTHORIZATION, THIRD_PARTY, COMPONENTS, RUNTIME_INFORMATION` | Required    |
| `log-message-severity` | Specifies the severity of the log message to exclude.                   | `FATAL_ERROR, INFORMATION, MILD_ERROR, MILD_WARNING, NOTICE, SEVERE_ERROR, SEVERE_WARNING, DEBUG`                                                                                                                                                                                                                                                  | Required    |
| `log-message-regex`    | Defines the regex string that must match the actual message of the log. | Any valid regex pattern.                                                                                                                                                                                                                                                                                                                           | Required    |
| `enabled`              | Specifies whether or not the policy suppresses log messages.            | A value of `true` activates the log message suppression. A value of `false` deactivates the suppression.                                                                                                                                                                                                                                           | Required    |
| `log-message-id`       | 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 `-1`.                                                                                                                                                                                                                               | Optional    |

## Steps

1. Create a log publisher message exclusion policy.

   ### Example:

   ```shell
   $ 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. |

2. Assign the exclusion policy to an existing log publisher using the `log-message-exclusion-policy` attribute.

   ### Example:

   ```shell
   $ bin/dsconfig set-log-publisher-prop \
     --publisher-name "Example Error Log Publisher" \
     --set "log-message-exclusion-policy:Test Policy"
   ```
