Log custom attributes

Preview

Dynatrace version 1.224+

Dynatrace log monitoring gives you the ability to define custom index log data attributes for log data that is ingested.

Dynatrace automatically detects attributes of ingested log data. These attributes are used in the log viewer facets to 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

  1. In the Dynatrace menu, go to Settings.
  2. Select Log Monitoring > Log custom attributes and then select Add custom attribute.
  3. Enter the Key.
    A key is case insensitive and can contain only alphanumeric characters, underscores ('_'), hyphens ('-'), and dots ('.'), and can't begin with a hyphen. Characters must be from the Latin alphabet, with no diacritics; characters such as 'ö' are not allowed.

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.

  1. Make an API call.
  2. Create a custom attribute. Creating a custom log attribute.
  3. View the attribute in log viewer. (See Log viewer for details.)
  4. Create a log metric with a custom log attribute as a dimension. (See Log metrics for details.)
    Creating log metric with custom log attribute as a dimension.
  5. Create a log event with a custom log attribute as a dimension. (See Log events for details) Creating log event with custom attribute as an additional property.

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.

Problem tile showing custom log attribute.

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.