Configuring whether logs are included or excluded
You can specify whether logs are included or excluded from collection based on a configured path or file name.
Including paths
To specify included paths, do the following:
- Download the YAML configuration file for your environment.
- Open the downloaded YAML configuration file in a text editor.
- Locate the
input-kubernetes.conf
section. - Update the
Path
parameter to specify the log sources that you want to collect.
By default, the Logging agent collects logs from a single source located at /var/log/containers/logger-agent-ds-*.log
. Make sure that you add the desired log source paths to the Path
parameter for your specific requirements.
Separate each path with a comma.
Consider the following example in input-kubernetes.conf
section:
input-kubernetes.conf: |
[INPUT]
Name tail
Tag kube.*
Path /var/log/containers/logger-agent-ds-*.log,/path/to/your/logs/*.log
Path_Key file
In this example:
- The
/var/log/containers/logger-agent-ds-*.log
path is the default log source. - Additional log sources can be specified after the comma in the
Path
parameter. For instance,/path/to/your/logs/*.log
is an additional log source.
Excluding paths
To specify paths to be excluded, do the following:
- Download the YAML configuration file for your environment.
- Open the downloaded
logger-agent.yaml
file in a text editor. - Locate the
input-kubernetes.conf
section. - Update the
Exclude_Path
parameter to specify the log sources that you want to exclude from collection. This parameter allows you to specify paths that should be ignored by the Logging agent.
The Exclude_Path
parameter might not be present by default, so you might need to add it if it does not exist. This parameter lets you to specify the paths that should be ignored by the Logging agent.
Consider the following example with Exclude_Path
specified:
If your directory structure is:
/path/to/your/logs
├── app1.log
├── app2.log
├── exclude-1.log
└── exclude-2.log
You can modify input-kubernetes.conf
section as follows:
input-kubernetes.conf: |
[INPUT]
Name tail
Tag kube.*
Path /var/log/containers/logger-agent-ds-*.log,/path/to/your/logs/*.log
Path_Key file
Exclude_Path /path/to/your/logs/exclude-1.log,/path/to/your/logs/exclude-2.log
In this example:
-
The
Path
parameter specifies two paths to be included:/var/log/containers/logger-agent-ds-*.log
/path/to/your/logs/*.log
-
The
Exclude_Path
parameter is used to specify two additional paths to be excluded:/path/to/your/logs/exclude-1.log
/path/to/your/logs/exclude-2.log
All files within the directory that match the pattern specified in the Path
parameter will be collected by the Logging agent, except for those matching the patterns specified in Exclude_Path
.
For more detailed information on configuring the Input Tail plugin, see the Fluent Bit documentation for the Input Tail plugin.