Dynatrace allows you to define rules that control log data timestamps.
By default, log monitoring automatically detects only the most common and unambiguous subset of date formats supported. For details, see Supported timestamp formats. Each time a timestamp pattern is detected, the line will be treated as the beginning of the log entry. All following lines without a detected timestamp will be treated as a continuation and reported as a single multi-line log record.
You can also control timestamp detection by using the following options from
Settings > Log monitoring > Advanced log settings:
Detect container time zones: This option enables the automatic detection of the timezone in a container's logs, if the timezone is not explicitly defined or configured.
Default timezone for agents: This options enables the default timezone for the agent if more specific configurations are not defined.
Timestamp search limit: This option defines the number of characters in every log line (starting from the first character in the line) where the timestamp is searched.
When Log Monitoring is unable to determine the time format, it treats each log line as a separate log entry with an automatically assigned timestamp (observation timestamp) using a one-minute time resolution, except for lines starting with whitespaces (space, tab), which are treated as a continuation of an entry.
Regardless of format, the timestamp typically occurs within the first 64 characters of a log entry. However, the timestamp can occur elsewhere, in which case you can raise this limit on the OneAgent configuration page: Log Monitoring > Timestamp/Splitting patterns.
Regardless of where it occurs in a log entry, a timestamp may be written in multiple formats. Dynatrace supports some timestamp formats by default, but sometimes multiple formats may fit the incoming log data and match the timestamp to an incorrect timestamp pattern.
Because of this, Log Monitoring also enables you to define a specific date format using timestamp rules that specify what should be considered a timestamp in a log record. These rules contain a timestamp pattern, time zone, and matchers.
%z).log.content attribute in the timestamp pattern matchers, the highest granularity is a log source. Granularity is at this level because the timestamp pattern is used to split the contents of a log source into separate log records, so it is used before the log.content attribute's value (or any other attributes set on an individual log record's level) is determined.
Consult the timestamp formats below as configuration examples:
Timestamp without the default separator: %Y-%m-%d-%H.%M.%S
Example: 2024-09-05-12.30.01
Using only timestamps from the beggining of the log entry (%^): %^%F %T
Example: 2024-09-05 12:30:01
Searching for a timestamp with the field name (JSON): "validTimestamp":"%Y-%m-%dT%H:%M:%S"
Example: "validTimestamp": "2024-09-05T12:30:01"
Timestamp with timezone offset: %m-%d-%Y %H:%M:%S %z
Example: 09-05-2024 12:30:01 +01:00
Timestamp with timezone name or abbreviation: %m-%d-%Y %H:%M:%S %Z
Example: 09-05-2024 12:30:01 UTC
Timestamp excluding the year (the current year is used to evaluate the timestamp): %b %t%d-%H:%M:%S
Here, %t maches zero or one white space characters.
Example: Apr 4-12:30:01 or Apr 14-12:30:01
Any timestamp with the myTime.* prefix: myTime%*: %Y-%m-%dT%H:%M:%S
Example: myTimeOfCreation: 2024-09-05T12:30:01
You can overwrite the default timezone by defining the timezone without the timestamp pattern.
Two digits year format: %m/%d/%y %H:%M:%S %Z
Example: 09/05/24 12:30:01 America/Chicago
When ingesting log entries, OneAgent parses the log entry for a timestamp. To do this, it uses a list of matcher patterns.
Therefore, it is possible that even if the log entry’s first timestamp matches the first pattern in the list of matching patterns, OneAgent will actually match the second timestamp—because the previous log entry matched the second pattern. See the code block below for an example.
Log entry 1: Pattern 1, Pattern 2Log entry 2: Pattern 2Log entry 3: Pattern 1, Pattern 2
For log entry 3, even if "Pattern 1" appears first in the list of matcher patterns, OneAgent will actually match "Pattern 2".
To ensure OneAgent evaluates only your desired timestamp patterns, carefully select which patterns are in your matching list. In the example above, to guarantee Pattern 1 is always used, remove Pattern 2 from your list. This may result in messages that only contain Pattern 2 timestamps to be dropped.
For example, if your log file contains both %FT%T (2024-01-01T12:30:01) and %F %T %Z (2024-01-01 12:30:01 UTC) patterns, and OneAgent successfully matches the first pattern in a line, it will prioritize that pattern for subsequent lines.
Four hierarchy scopes are supported: host, host group, and environment.
The hierarchy scopes are merged into one list in the following order:

The OneAgent receives the merged list (merged lists from its respective hosts, host groups, and environments) with no indication of which scopes are defined.
The host scope can be accessed through the Host settings for a specific host.
Hosts Classic.The Kubernetes cluster scope can be accessed via the Kubernetes page.
The host group scope can be accessed via the Host page.
Hosts Classic and select the host that interests you.The Host group property is not displayed when the selected host doesn't belong to any host group.
<group name> link, where <group name> is the name of the host group that you want to configure.The environment scope is available in the settings menu.
To add a rule (on the host, host group, or environment level) that interprets the incoming log data timestamps
Select Add rule to start configuring your rule.
Rule name
The name to display for your configuration.
Pattern
Enter the pattern to be read as a date from the logs. For details on timestamp formats, see Supported timestamp formats and the following list of format specifiers.
You need to specify at least the month, day, hours, minutes, and seconds, although you can use alternative formats for them. You can include the time zone indicator (%z) or specify the time zone separately in the rule definition.
Rules without a pattern can override the timezone only for default supported timestamps.
Timestamp search limit
Use this field to define the number of characters in every log line where timestamp is searched. If you want to ignore timestamps and split logs using the default rules, set this value to 0. Use this field to overwrite the global timestamp search limit (default 64 bytes).
Entry boundary
Use this field to provide a fragment of the text from the first line of the entry.
Time zone
Select the time zone to apply to this pattern.
This setting is not enabled if you have already specified the timezone in the timestamp pattern (%z).
You can select Local time zone to use the time zone of the host on which the OneAgent is running.
Select Add condition to create a specific match for this rule and narrow down the scope for that rule.
You can include multiple matchers in one rule. For example, the timestamp configuration rule can be applied to logs from a specific container, namespace, or log source. Multiple matchers with the same attribute use AND logic between matchers, while matchers with multiple values assigned to them use OR logic.
The minimum required OneAgent version is 1.295.
Manually or automatically applied tags are not visible to OneAgent.
The minimum required OneAgent version is 1.289.
The minimum required OneAgent Log Module version is 1.309.
The minimum required Dynatrace Operator version is 1.4.2.
Select the matching attribute.
Select Value and, from the Value list, select the detected log data items.
You can add multiple values to the selected attribute. You can have one matcher that indicates the Log source and matches values /var/log/syslog and Windows Application Log. Use asterisks (*) as wildcards to get a partial match.
Select Save changes.
Rules are executed in the order in which they appear on the Timestamp/Splitting patterns page.
When you change the rule order (to change the order in which they are executed), allow for two or three minutes of propagation time between when you save the change and when the change takes effect.
Starting with OneAgent version 1.249, you can activate/inactivate your rules by turning on/off the Active toggle. To manage your rules effectively, we recommend that you upgrade your OneAgent to version 1.249. If you have any rules set on the host with OneAgent version earlier than 249, you will not be able to inactivate them, in which case you need to remove such rules by selecting Delete on the rule level or via the REST API.
Rules are executed in the order in which they appear on the Timestamp/Splitting patterns page.
You can add a maximum of 100 timestamp rules per each scope (host, host group, Kubernetes cluster, or environment).
You can use the Settings API to manage your timestamp configuration:
To check the current schema version for timestamp configuration, list all available schemas and look for the builtin:logmonitoring.timestamp-configuration schema identifier.
Timestamp configuration objects are available for configuration on the following scopes:
environment—configuration object affects all hosts in a given environment.host_group—configuration object affects all hosts assigned to a given host group.host—configuration object affects only the given host.To create a timestamp configuration using the API
Create an access token with the Write settings (settings.write) and Read settings (settings.read) permissions.
Use the GET a schema endpoint to learn the JSON format required to post your configuration. The timestamp configuration schema identifier (schemaId) is builtin:logmonitoring.timestamp-configuration. Here is an example JSON payload with the timestamp configuration:
[{"insertAfter":"uAAZ0ZW5hbnQABnRlbmFudAAkMGUzYmY2ZmYtMDc2ZC0zNzFmLhXaq0","schemaId": "builtin:logmonitoring.timestamp-configuration","schemaVersion": "0.1.0","scope": "tenant","value": {"config-item-title": "Added from REST API","date-time-pattern": "%Y-%m-%d %H:%M:%S","timezone": "CET","matchers": [{"attribute": "dt.entity.process_group","operator": "MATCHES","values": ["PROCESS_GROUP-05F00CBACF39EBD1"]},{"attribute": "log.source","operator": "MATCHES","values": ["Windows System Log","Windows Security Log"]}]}}]
Use the POST an object endpoint to send your configuration.