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.
.. attribute:: name
Required. The client-assigned metric identifier. Examples:
"error_count"
, "nginx/requests"
. Metric identifiers
are limited to 100 characters and can include only the
following characters: A-Z
, a-z
, 0-9
, and the
special characters _-.,+!*',()%/
. The forward-slash
character (/
) denotes a hierarchy of name pieces, and it
cannot be the first character of the name. The metric
identifier in this field must not be URL-encoded
<https://en.wikipedia.org/wiki/Percent-encoding>
__. However,
when the metric identifier appears as the [METRIC_ID]
part
of a metric_name
API parameter, then the metric identifier
must be URL-encoded. Example: "projects/my-
project/metrics/nginx%2Frequests"
.
Required. An advanced logs filter
</logging/docs/view/advanced_filters>
__ which is used to
match log entries. Example: :: "resource.type=gae_app
AND severity>=ERROR" The maximum length of the filter is
20000 characters.
Optional. A value_extractor
is required when using a
distribution logs-based metric to extract the values to record
from a log entry. Two functions are supported for value
extraction: EXTRACT(field)
or REGEXP_EXTRACT(field,
regex)
. The argument are: 1. field: The name of the log
entry field from which the value is to be extracted. 2. regex:
A regular expression using the Google RE2 syntax
(https://github.com/google/re2/wiki/Syntax) with a single
capture group to extract data from the specified log entry
field. The value of the field is converted to a string before
applying the regex. It is an error to specify a regex that
does not include exactly one capture group. The result of the
extraction must be convertible to a double type, as the
distribution always records double values. If either the
extraction or the conversion to double fails, then those
values are not recorded in the distribution. Example:
REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")
Optional. The bucket_options
are required when the logs-
based metric is using a DISTRIBUTION value type and it
describes the bucket boundaries used to create a histogram of
the extracted values.
Output only. The last update timestamp of the metric. This field may not be present for older metrics.
Inheritance
builtins.object > google.protobuf.pyext._message.CMessage > builtins.object > google.protobuf.message.Message > LogMetricClasses
LabelExtractorsEntry
API documentation for logging_v2.types.LogMetric.LabelExtractorsEntry
class.