Log monitoring metrics API - GET a metric

Gets the definition of the specified custom log metric.

The request produces an application/json payload.

Early Adopter

This request is an Early Adopter release and may be changed in non-compatible way.

GET
  • Managed https://{your-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/log/{metricKey}
  • SaaS https://{your-environment-id}.live.dynatrace.com/api/config/v1/calculatedMetrics/log/{metricKey}

Parameters

Parameter Type Description In Required
metricKey string

The key of the required custom log metric.

path required

Response format

The LogMetricConfig object

Custom log metric definition.

Element Type Description
metricKey string

The unique key of the metric.

The key must have the calc:log. prefix.

active boolean

The metric is enabled (true) or disabled (false).

displayName string

The name of the metric, displayed in the UI.

unit string

The unit of the metric.

The unit element can hold these values.
unitDisplayName string

The display name of the unit.

Only applicable if the unit is set to UNSPECIFIED.

searchString string

The pattern to look for in logs.

Use the Dynatrace search query language to specify it. Quotes must be escaped.

To return all results, leave the field blank.

metricValueType string

The type of the metric data points calculation. For now the only allowed value is OCCURRENCES.

The metricValueType element can hold these values.
columnDefiningValue ColumnDefinition
logSourceFilters LogSourceFilter[]

A list of filters to define the logs to look into.

If several filters are specified, the OR logic applies.

The LogSourceFilter object

Configuration of the log filter for a custom log metric.

If several criteria are specified, the AND logic applies.

Element Type Description
pathDefinitions PathDefinition[]

A list of filtering criteria for log path.

If several criteria are specified, the OR logic applies.

sourceEntities string[]

A list of Dynatrace entities, where the log can originate from. Specify Dynatrace entity IDs here.

Allowed types of entities are PROCESS_GROUP and PROCESS_GROUP_INSTANCE. You can't mix entity types.

If several entities are specified, the OR logic applies.

This field is mutually exclusive with the osTypes field.

hostFilters string[]

A list of hosts, where the log can originate from. Specify Dynatrace entity IDs here.

If several hosts are specified, the OR logic applies.

osTypes string[]

A list of operating system types, where the log can originate from.

If set, only OS logs are included in the result.

If several OS are specified, the OR logic applies.

This field is mutually exclusive with the sourceEntities field.

The PathDefinition object

A filtering criterion for log path.

Element Type Description
definition string

The path to the required log path.

If the type is set to WILDCARD, it may contain wildcard characters (*).

type string

The type of the log path definition: fixed or an expression with wildcards.

The type element can hold these values.

The ColumnDefinition object

Definition of numeric column.

Element Type Description
name string
type string

Defines the actual set of fields depending on the value. See one of the following objects:

  • CUSTOM -> CustomColumnDefinition
  • JSON -> JsonColumnDefinition
The type element can hold these values.

Possible values

Possible values for the osTypes element in the LogSourceFilter object:

  • AIX
  • DARWIN
  • HPUX
  • LINUX
  • SOLARIS
  • WINDOWS
  • ZOS

Possible values for the type element in the PathDefinition object:

  • FIXED
  • WILDCARD

Possible values for the type element in the ColumnDefinition object:

  • CUSTOM
  • JSON

Possible values for the metricValueType element in the LogMetricConfig object:

  • FP_COLUMN_AVG
  • FP_COLUMN_COUNT
  • FP_COLUMN_MAX
  • FP_COLUMN_MIN
  • FP_COLUMN_SUM
  • FP_COLUMN_TOP_X_AVG
  • FP_COLUMN_TOP_X_COUNT
  • FP_COLUMN_TOP_X_MAX
  • FP_COLUMN_TOP_X_MIN
  • FP_COLUMN_TOP_X_SUM
  • INT_COLUMN_AVG
  • INT_COLUMN_COUNT
  • INT_COLUMN_MAX
  • INT_COLUMN_MIN
  • INT_COLUMN_SUM
  • INT_COLUMN_TOP_X_AVG
  • INT_COLUMN_TOP_X_COUNT
  • INT_COLUMN_TOP_X_MAX
  • INT_COLUMN_TOP_X_MIN
  • INT_COLUMN_TOP_X_SUM
  • OCCURRENCES

Possible values for the unit element in the LogMetricConfig object:

  • BIT
  • BIT_PER_HOUR
  • BIT_PER_MINUTE
  • BIT_PER_SECOND
  • BYTE
  • BYTE_PER_HOUR
  • BYTE_PER_MINUTE
  • BYTE_PER_SECOND
  • CORES
  • COUNT
  • DAY
  • GIBI_BYTE
  • GIGA
  • GIGA_BYTE
  • HOUR
  • KIBI_BYTE
  • KIBI_BYTE_PER_HOUR
  • KIBI_BYTE_PER_MINUTE
  • KIBI_BYTE_PER_SECOND
  • KILO
  • KILO_BYTE
  • KILO_BYTE_PER_HOUR
  • KILO_BYTE_PER_MINUTE
  • KILO_BYTE_PER_SECOND
  • MEBI_BYTE
  • MEBI_BYTE_PER_HOUR
  • MEBI_BYTE_PER_MINUTE
  • MEBI_BYTE_PER_SECOND
  • MEGA
  • MEGA_BYTE
  • MEGA_BYTE_PER_HOUR
  • MEGA_BYTE_PER_MINUTE
  • MEGA_BYTE_PER_SECOND
  • MICRO_SECOND
  • MILLI_CORES
  • MILLI_SECOND
  • MILLI_SECOND_PER_MINUTE
  • MINUTE
  • MONTH
  • NANO_SECOND
  • NANO_SECOND_PER_MINUTE
  • NOT_APPLICABLE
  • PERCENT
  • PER_HOUR
  • PER_MINUTE
  • PER_SECOND
  • PIXEL
  • PROMILLE
  • RATIO
  • SECOND
  • STATE
  • UNSPECIFIED
  • WEEK
  • YEAR

Example

In this example, the request gets the definition of the Unknown parameter custom log metric.

The metric counts the occurrences of the phrase Unknown parameter in the following logs:

  • All logs from the process with Dynatrace entity ID PROCESS_GROUP_INSTANCE-6CD96121AD8F5308 that runs on the host with Dynatrace entity ID HOST-5AA1203365B14DB.
  • The /var/log/ansible.log from the process with Dynatrace entity ID PROCESS_GROUP_INSTANCE-7CD17F573CC3DA3F that runs on the host with Dynatrace entity ID HOST-E0D8F94D9065F24F.

The API token is passed in the Authorization header.

Curl

curl -X GET \
  https://mySampleEnv.live.dynatrace.com/api/config/v1/calculatedMetrics/log/calc:log.runknownparameter \
  -H 'Authorization: Api-token abcdefjhij1234567890'

Request URL

https://mySampleEnv.live.dynatrace.com/api/config/v1/calculatedMetrics/log/calc:log.runknownparameter

Response body

{
  "metricKey": "calc:log.runknownparameter",
  "active": true,
  "displayName": "Unknown parameter",
  "unit": "COUNT",
  "unitDisplayName": null,
  "searchString": "\"unknown parameter\"",
  "metricValueType": "OCCURRENCES",
  "logSourceFilters": [
    {
      "pathDefinitions": [],
      "sourceEntities": [
        "PROCESS_GROUP_INSTANCE-6CD96121AD8F5308"
      ],
      "hostFilters": [
        "HOST-5AA1203365B14DBC"
      ],
      "osTypes": []
    },
    {
      "pathDefinitions": [
        {
          "definition": "/var/log/ansible.log",
          "type": "FIXED"
        }
      ],
      "sourceEntities": [
        "PROCESS_GROUP_INSTANCE-7CD17F573CC3DA3F"
      ],
      "hostFilters": [
        "HOST-E0D8F94D9065F24F"
      ],
      "osTypes": []
    }
  ]
}

Response code

200