loglabels

package
v1.75.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K8sLabelPod        = "pod"
	K8sLabelPodLabels  = "pod_labels"
	K8sLabelPodIP      = "pod_ip"
	K8sLabelNamespace  = "namespace"
	K8sLabelImage      = "image"
	K8sLabelContainer  = "container"
	K8sLabelNode       = "node"
	K8sLabelPodOwner   = "pod_owner"
	K8sLabelNodeLabels = "node_labels"
)

Kubernetes label field names used in kubernetes_logs source annotation_fields.

Variables

View Source
var FilesLabels = map[string]string{
	"host":    "{{ .host }}",
	"host_ip": "{{ .host_ip }}",
	"file":    "{{ file }}",
}

FilesLabels contains default file labels for log destinations.

View Source
var K8sLabels = map[string]string{
	K8sLabelNamespace: "{{ namespace }}",
	K8sLabelContainer: "{{ container }}",
	K8sLabelImage:     "{{ image }}",
	K8sLabelPod:       "{{ pod }}",
	K8sLabelNode:      "{{ node }}",
	K8sLabelPodIP:     "{{ pod_ip }}",
	"stream":          "{{ stream }}",
	"node_group":      "{{ node_group }}",
	K8sLabelPodOwner:  "{{ pod_owner }}",
}

K8sLabels contains default Kubernetes labels for log destinations.

View Source
var K8sLabelsWithPodLabels = func() map[string]string {
	result := make(map[string]string, len(K8sLabels)+1)
	maps.Copy(result, K8sLabels)
	result[podLabelsStar] = "{{ pod_labels }}"
	return result
}()

K8sLabelsWithPodLabels contains K8sLabels plus pod_labels_*.

Functions

func GetCEFExtensions

func GetCEFExtensions(sourceType string, extraLabels map[string]string) map[string]string

GetCEFExtensions returns CEF extensions map: source labels (K8s without pod_labels) + extraLabels, with message/timestamp.

func GetLokiLabels

func GetLokiLabels(sourceType string, extraLabels map[string]string) map[string]string

GetLokiLabels returns labels for Loki: source labels (with pod_labels for K8s) + extraLabels.

func GetSplunkLabels

func GetSplunkLabels(sourceType string, extraLabels map[string]string) map[string]string

GetSplunkLabels returns indexed fields for Splunk: datetime + source labels (K8s without pod_labels) + extraLabels.

func SortedMapKeys

func SortedMapKeys(m map[string]string) []string

SortedMapKeys returns sorted keys from a map for deterministic order.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL