• Home
  • Dynatrace API
  • Configuration
  • Calculated metrics
  • Log Monitoring
  • GET a metric

Log Monitoring metrics API - GET a metric

Gets the descriptor of the specified calculated Log Monitoring metric.

The request produces an application/json payload.

GETManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/log/{metricKey}
SaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/calculatedMetrics/log/{metricKey}
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/log/{metricKey}

Authentication

To execute this request, you need an access token with ReadConfig scope.

To learn how to obtain and use it, see Tokens and authentication.

Parameters

ParameterTypeDescriptionInRequired
metricKeystring

The key of the required custom log metric.

pathrequired

Response

Response codes

CodeTypeDescription
200LogMetricConfig

Success

400ErrorEnvelope

Failed. See the response body for details

Response body objects

The LogMetricConfig object

Custom log metric definition.

ElementTypeDescription
metricKeystring

The unique key of the metric.

The key must have the calc:log. prefix.

activeboolean

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

displayNamestring

The name of the metric, displayed in the UI.

unitstring

The unit of the metric.

The element can hold these values
  • BILLION
  • BIT
  • BIT_PER_HOUR
  • BIT_PER_MINUTE
  • BIT_PER_SECOND
  • BYTE
  • BYTE_PER_HOUR
  • BYTE_PER_MINUTE
  • BYTE_PER_SECOND
  • CORES
  • COUNT
  • DAY
  • DECIBEL_MILLI_WATT
  • GIBI_BYTE
  • GIBI_BYTE_PER_HOUR
  • GIBI_BYTE_PER_MINUTE
  • GIBI_BYTE_PER_SECOND
  • GIGA
  • GIGA_BYTE
  • GIGA_BYTE_PER_HOUR
  • GIGA_BYTE_PER_MINUTE
  • GIGA_BYTE_PER_SECOND
  • 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
  • KILO_METRE_PER_HOUR
  • 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
  • METRE_PER_HOUR
  • METRE_PER_SECOND
  • MICRO_SECOND
  • MILLION
  • MILLI_CORES
  • MILLI_SECOND
  • MILLI_SECOND_PER_MINUTE
  • MINUTE
  • MONTH
  • MSU
  • NANO_SECOND
  • NANO_SECOND_PER_MINUTE
  • NOT_APPLICABLE
  • PERCENT
  • PER_HOUR
  • PER_MINUTE
  • PER_SECOND
  • PIXEL
  • PROMILLE
  • RATIO
  • SECOND
  • STATE
  • TRILLION
  • UNSPECIFIED
  • WEEK
  • YEAR
unitDisplayNamestring

The display name of the unit.

Only applicable if the unit is set to UNSPECIFIED.

searchStringstring

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.

metricValueTypestring

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

The element can hold these values
  • 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
columnDefiningValueColumnDefinition

Definition of numeric column.

logSourceFiltersLogSourceFilter[]

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

If several filters are specified, the OR logic applies.

The ColumnDefinition object

Definition of numeric column.

ElementTypeDescription
namestring-
typestring

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

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

The LogSourceFilter object

Configuration of the log filter for a custom log metric.

If several criteria are specified, the AND logic applies.

ElementTypeDescription
pathDefinitionsPathDefinition[]

A list of filtering criteria for log path.

If several criteria are specified, the OR logic applies.

sourceEntitiesstring[]

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.

hostFiltersstring[]

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

If several hosts are specified, the OR logic applies.

osTypesstring[]

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 element can hold these values
  • AIX
  • DARWIN
  • HPUX
  • LINUX
  • SOLARIS
  • WINDOWS
  • ZOS

The PathDefinition object

A filtering criterion for log path.

ElementTypeDescription
definitionstring

The path to the required log path.

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

typestring

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

The element can hold these values
  • FIXED
  • WILDCARD

Response body JSON model

json
{ "metricKey": "calc:log.metric", "active": true, "displayName": "Sample metric", "unit": "HOUR", "unitDisplayName": "", "searchString": "\"memory fault\"", "metricValueType": "OCCURRENCES", "logSourceFilters": [ { "pathDefinitions": [ { "definition": "/var/log/sample.log", "type": "FIXED" } ], "sourceEntities": [ "PROCESS_GROUP_INSTANCE-63FC6E7C73DC893F" ], "hostFilters": [ "HOST-066703AD79C38DB5" ], "osTypes": [] } ] }

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

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

Request URL

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

Response body

json
{ "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

Related topics
  • Log Monitoring Classic

    Learn how to enable Log Monitoring, the insights that Log Monitoring can provide, and more.