--- title: Log Entry description: A template that represents a single runtime log entry. location: https://istio.io/docs/reference/config/policy-and-telemetry/templates/logentry.html layout: protoc-gen-docs generator: protoc-gen-docs aliases: - /docs/reference/config/template/logentry.html number_of_entries: 3 ---

The `logentry` template represents an individual entry within a log.

Example config:

    apiVersion: "config.istio.io/v1alpha2"
    kind: logentry
    metadata:
      name: accesslog
      namespace: istio-system
    spec:
      severity: '"Default"'
      timestamp: request.time
      variables:
        sourceIp: source.ip | ip("0.0.0.0")
        destinationIp: destination.ip | ip("0.0.0.0")
        sourceUser: source.user | ""
        method: request.method | ""
        url: request.path | ""
        protocol: request.scheme | "http"
        responseCode: response.code | 0
        responseSize: response.size | 0
        requestSize: request.size | 0
        latency: response.duration | "0ms"
      monitored_resource_type: '"UNSPECIFIED"'

## Template

The `logentry` template represents an individual entry within a log.

When writing the configuration, the value for the fields associated with this template can either be a literal or an expression. Please note that if the datatype of a field is not istio.policy.v1beta1.Value, then the expression’s inferred type must match the datatype of the field.

Field | Type | Description
--- | --- | ---
`variables` | `map<string, istio.policy.v1beta1.Value>` | Variables that are delivered for each log entry.
`timestamp` | `istio.policy.v1beta1.TimeStamp` | Timestamp is the time value for the log entry
`severity` | `string` | Severity indicates the importance of the log entry.
`monitoredResourceType` | `string` | Optional. An expression to compute the type of the monitored resource this log entry is being recorded on. If the logging backend supports monitored resources, these fields are used to populate that resource. Otherwise these fields will be ignored by the adapter.
`monitoredResourceDimensions` | `map<string, istio.policy.v1beta1.Value>` | Optional. A set of expressions that will form the dimensions of the monitored resource this log entry is being recorded on. If the logging backend supports monitored resources, these fields are used to populate that resource. Otherwise these fields will be ignored by the adapter.

## istio.policy.v1beta1.TimeStamp

An instance field of type TimeStamp denotes that the expression for the field must evalaute to ValueType.TIMESTAMP

Objects of type TimeStamp are also passed to the adapters during request-time for the instance fields of type TimeStamp

Field | Type | Description
--- | --- | ---
`value` | `google.protobuf.Timestamp` | TimeStamp encoded as google.protobuf.Timestamp.

## istio.policy.v1beta1.Value

An instance field of type Value denotes that the expression for the field is of dynamic type and can evalaute to any ValueType enum values. For example, when authoring an instance configuration for a template that has a field `data` of type `istio.policy.v1beta1.Value`, both of the following expressions are valid `data: source.ip | ip("0.0.0.0")`, `data: request.id | ""`; the resulting type is either ValueType.IP_ADDRESS or ValueType.STRING for the two cases respectively.

Objects of type Value are also passed to the adapters during request-time. There is a 1:1 mapping between oneof fields in `Value` and enum values inside `ValueType`. Depending on the expression’s evaluated `ValueType`, the equivalent oneof field in `Value` is populated by Mixer and passed to the adapters.

Field | Type | Description
--- | --- | ---
`stringValue` | `string (oneof)` | Used for values of type STRING
`int64Value` | `int64 (oneof)` | Used for values of type INT64
`doubleValue` | `double (oneof)` | Used for values of type DOUBLE
`boolValue` | `bool (oneof)` | Used for values of type BOOL
`ipAddressValue` | `istio.policy.v1beta1.IPAddress (oneof)` | Used for values of type IPAddress
`timestampValue` | `istio.policy.v1beta1.TimeStamp (oneof)` | Used for values of type TIMESTAMP
`durationValue` | `istio.policy.v1beta1.Duration (oneof)` | Used for values of type DURATION
`emailAddressValue` | `istio.policy.v1beta1.EmailAddress (oneof)` | Used for values of type EmailAddress
`dnsNameValue` | `istio.policy.v1beta1.DNSName (oneof)` | Used for values of type DNSName
`uriValue` | `istio.policy.v1beta1.Uri (oneof)` | Used for values of type Uri