Before to get started with the plugin configuration, make sure to obtain the proper credentials to get access to the service. We strongly recommend to use a common JSON credentials file, reference link:
The GCP or AWS region in which to store data about the resource. If the resource type is one of the generic_node or generic_task, then this field is required.
A namespace identifier, such as a cluster name or environment. If the resource type is one of the generic_node or generic_task, then this field is required.
A unique identifier for the node within the namespace, such as hostname or IP address. If the resource type is generic_node, then this field is required.
An identifier for a grouping of related task, such as the name of a microservice or distributed batch. If the resource type is generic_task, then this field is required.
A unique identifier for the task within the namespace and job, such as a replica index identifying the task within the job. If the resource type is generic_task, then this field is required.
The GCP project that should receive these logs.
Defaults to the project ID of the google_service_credentials file, or the project_id from Google's metadata.google.internal server.
Set resource type of data. Supported resource types: k8s_container, k8s_node, k8s_pod, global, generic_node, generic_task, and gce_instance.
The name of the cluster that the container (node or pod based on the resource type) is running in. If the resource type is one of the k8s_container, k8s_node or k8s_pod, then this field is required.
The physical location of the cluster that contains (node or pod based on the resource type) the container. If the resource type is one of the k8s_container, k8s_node or k8s_pod, then this field is required.
The value of this field is used by the Stackdriver output plugin to find the related labels from jsonPayload and then extract the value of it to set the LogEntry Labels.
Optional list of comma separated of strings specifying key=value pairs. The resulting labels will be combined with the elements in obtained from labels\_key to set the LogEntry Labels. Elements from labels will override duplicate values from labels\_key.
The value of this field is used by the Stackdriver output plugin to extract logName from jsonPayload and set the logName field.
Set the tag_prefix used to validate the tag of logs with k8s resource type. Without this option, the tag of the log must be in format of k8s_container(pod/node).* in order to use the k8s_container resource type. Now the tag prefix is configurable by this option (note the ending dot).
k8s_container., k8s_pod., k8s_node.
Specify the name of the key from the original record that contains the severity information.
Rewrite the trace field to include the projectID and format it for use with Cloud Trace. When this flag is enabled, the user can get the correct result by printing only the traceID (usually 32 characters).
Enables dedicated thread(s) for this output. Default value is set since version 1.8.13. For previous versions is 0.
If you are using a Google Cloud Credentials File, the following configuration is enough to get started:
Example configuration file for k8s resource type:
local_resource_id is used by stackdriver output plugin to set the labels field for different k8s resource types. Stackdriver plugin will try to find the local_resource_id field in the log entry. If there is no field logging.googleapis.com/local_resource_id in the log, the plugin will then construct it by using the tag value of the log.
This implies that if there is no local_resource_id in the log entry then the tag of logs should match this format. Note that we have an option tag_prefix so it is not mandatory to use k8s_container(node/pod) as the prefix for tag.