Log custom attributes (Logs Classic)
Log Monitoring Classic
Dynatrace automatically detects attributes of ingested log data. Available attributes quickly filter the result table data for a specific log data attribute.
You can also define your own custom log data attributes that suits your particular log data format. Similarly to the automatically detected log attributes, your custom log attributes are extracted from the log data during ingestion and become available within Dynatrace.
You can use them as filters in the log viewer (table options and log record detail attributes), as dimensions while creating log metrics, and as properties while creating log events.
These custom attributes must match log attributes in ingested log data or they will be ignored.
Dynatrace version 1.226+
Dynatrace automatically recognizes log attributes that are visible in log details and table options.
Create a custom log attribute
- In the Dynatrace menu, go to Settings.
- Select Log Monitoring > Log custom attributes and then select Add custom attribute.
- Enter the Key.
Rules for keys:- Keys are not case sensitive.
- A key can contain only alphanumeric characters, underscores ('_'), hyphens ('-'), and dots ('.').
- It can't begin with a hyphen.
- All characters must be from the Latin alphabet, with no diacritics; characters such as 'ö' are not allowed.
Note: You can check if the custom attributes you plan to add are part of the key-values attributes list for automatic detection. If they are present there, there is no need to add them to the custom list.
Dynatrace Log Monitoring gives you the ability to define custom index log data attributes for log data that is ingested.
Example
In this example, you will make an API log ingest call with JSON that contains the following log attributes:
{
"timestamp": "2021-07-29T10:54:40.962165022Z",
"level": "error",
"source": "Skynet",
"application.id": "PaymentService-Prod",
"message": "PaymentService-Prod failure.",
"data": {}
}
Then you will create a custom log attribute and use it for creating a log metric and a log event.
-
Make an API call.
-
Create a custom attribute.
-
View the attribute in log viewer. (See Log viewer (Logs Classic) for details.)
-
Check Available attributes
-
Check table options
-
Check log entry/record details
-
-
Create a log metric with a custom log attribute as a dimension. (See Log metrics (Logs Classic) for details.)
- Check Metrics for a new log metric. For the new log metric to be listed in Metrics, Dynatrace first must ingest log data with log records matching the query specified when creating the log metric.
-
Create a log event with a custom log attribute as a dimension. (See Log events (Logs Classic) for details)
Once the log data is ingested and analyzed, Dynatrace will generate a problem. You can drill down from a listed problem to get the details.
The problem details will include the defined attributes and their value (application.id
and PaymentService-Prod
). You can then further examine the log data by selecting Analyze logs. This will take you to the log viewer with a predefined filter query containing predicates that are relevant to the area of the problem.