The k8s_metadata_decorator
operator adds labels and annotations to the entry using data from the Kubernetes metadata API.
Field | Default | Description |
---|---|---|
id |
k8s_metadata_decorator |
A unique identifier for the operator |
output |
Next in pipeline | The connected operator(s) that will receive all outbound entries |
namespace_field |
namespace |
A field that contains the k8s namespace associated with the log entry |
pod_name_field |
pod_name |
A field that contains the k8s pod name associated with the log entry |
cache_ttl |
10m | A duration indicating the time it takes for a cached entry to expire |
timeout |
10s | A duration indicating how long to wait for the API to respond before timing out |
Configuration:
- type: k8s_metadata_decorator
Input record | Output record |
{
"timestamp": "",
"record": {
"namespace": "my-namespace",
"pod_name": "samplepod-6cdcf6bf9d-f4f9n"
}
} |
{
"timestamp": "",
"labels": {
"k8s_ns_annotation/addonmanager.kubernetes.io/mode": "Reconcile",
"k8s_ns_annotation/control-plane": "true",
"k8s_ns_annotation/kubernetes.io/cluster-service": "true",
"k8s_ns_label/addonmanager.kubernetes.io/mode": "Reconcile",
"k8s_ns_label/control-plane": "true",
"k8s_ns_label/kubernetes.io/cluster-service": "true",
"k8s_pod_annotation/k8s-app": "dashboard-metrics-scraper",
"k8s_pod_annotation/pod-template-hash": "5f44bbb8b5",
"k8s_pod_label/k8s-app": "dashboard-metrics-scraper",
"k8s_pod_label/pod-template-hash": "5f44bbb8b5"
},
"record": {
"namespace": "my-namespace",
"pod_name": "samplepod-6cdcf6bf9d-f4f9n"
}
} |