OneAgent version 1.351+
Log source configuration rules let you set how OneAgent reads the log sources that match a rule. Each rule can define:
The rules apply to all log sources that OneAgent reads, both autodiscovered and custom. Use them to set these options in one place instead of in each custom log source rule.
Log source configuration rules only define how OneAgent reads a log source. To store the logs in Dynatrace, you still need a matching log ingest rule.
Use log source configuration rules when:
You can define log source configuration rules at four scopes: host, Kubernetes cluster, host group, and environment.
OneAgent merges the rules from all scopes into one list in the following order:
Kubernetes and select Clusters.On the Sources configuration tab at the scope you need, select New rule.
Enter a Rule name.
Under Matchers, select an Attribute from the dropdown and enter the matching Values to define which log sources the rule applies to. Select Add another matcher to add more conditions. All matchers in a rule must match for the rule to apply.
You can use the same matcher attributes as in timestamp/splitting rules, such as log source, process group, host tag, and Kubernetes attributes. Because OneAgent applies the rule before it reads individual log records, you can't match on log.content.
Optional Select the encoding from the Encoding dropdown.
Set the encoding when OneAgent can't detect it, for example, because the file has no BOM marker or uses a specific encoding for diacritical characters. Supported encodings are UTF-8, UTF-16 big-endian, UTF-16 little-endian, Shift_JIS, EUC_JP, and EUC_KR.
Optional Turn on Allow binary content to ingest content from files that contain binary data. OneAgent escapes non-text data. Turn on this option when a file consists mostly of text log records but also contains some binary data.
Optional Set the Rotation pattern. See Rotation pattern options for details.
Select Save changes.
Turn on Active to activate your rule.
You can reorder the rules within a scope. The order matters, because the first matching rule takes precedence. See Rule precedence.
By default, OneAgent detects log rotation automatically, as described in Log rotation patterns. Use the rotation pattern option to tell OneAgent how the matched files behave:
Setting No rotation for log sources that aren't rotated prevents missing log data and reduces the processing time that automatic rotation detection needs.
Set No rotation only for log files that are never rotated. For rotated files, keep the default so that OneAgent can follow the rotation.
When several rules match the same log source, OneAgent evaluates the merged list of rules from top to bottom:
You can also set Encoding and Allow binary content in a custom log source rule. If both a custom log source rule and a log source configuration rule set the same option for a log source, the custom log source rule takes precedence.
For example, if a custom log source rule sets the encoding to UTF-16 little-endian and a matching log source configuration rule sets it to Shift_JIS, OneAgent reads the file as UTF-16 little-endian.
To avoid conflicts, set encoding and binary content in log source configuration rules only, and leave them empty in custom log source rules.
OneAgent versions earlier than 1.351 don't read log source configuration rules. On these versions, set encoding and binary content in custom log source rules.