Class LogMetric (1.14.0)

Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.

Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.

Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.

Optional. The metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. The name, type, and description fields in the metric_descriptor are output only, and is constructed using the name and description field in the LogMetric. To create a logs- based metric that records a distribution of log values, a DELTA metric kind with a DISTRIBUTION value type must be used along with a value_extractor expression in the LogMetric. Each label in the metric descriptor must have a matching label name as the key and an extractor expression as the value in the label_extractors map. The metric_kind and value_type fields in the metric_descriptor cannot be updated once initially configured. New labels can be added in the metric_descriptor, but existing labels cannot be modified except for their description.

Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the value_extractor field. The extracted value is converted to the type defined in the label descriptor. If the either the extraction or the type conversion fails, the label will have a default value. The default value for a string label is an empty string, for an integer label its 0, and for a boolean label its false. Note that there are upper bounds on the maximum number of labels and the number of active time series that are allowed in a project.

Output only. The creation timestamp of the metric. This field may not be present for older metrics.

Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed.

Classes

LabelExtractorsEntry

API documentation for logging_v2.types.LogMetric.LabelExtractorsEntry class.