Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrics index from annotations #1053

Merged
merged 9 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .chloggen/metric-index-from-annottaions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement
# The name of the component, or a single word describing the area of concern, (e.g. agent, clusterReceiver, gateway, networkExplorer, operator, chart, other)
component: other
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Added support for rerouting metrics index with pod/namespace annotations
# One or more tracking issues related to the change
issues: []
sbylica-splunk marked this conversation as resolved.
Show resolved Hide resolved
# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
1 change: 1 addition & 0 deletions docs/advanced-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ Manage Splunk OTel Collector Logging with these supported annotations.

* Use `splunk.com/index` annotation on pod and/or namespace to tell which Splunk platform indexes to ingest to. Pod annotation will take precedence over namespace annotation when both are annotated.
For example, the following command will make logs from `kube-system` namespace to be sent to `k8s_events` index: `kubectl annotate namespace kube-system splunk.com/index=k8s_events`
* Use `splunk.com/metricsIndex` annotation on pod and/or namespace to tell which Splunk platform metric indexes to ingest to. Pod annotation will take precedence over namespace annotation when both are annotated.
* Filter logs using pod and/or namespace annotation
* If `logsCollection.containers.useSplunkIncludeAnnotation` is `false` (default: false), set `splunk.com/exclude` annotation to `true` on pod and/or namespace to exclude its logs from ingested.
* If `logsCollection.containers.useSplunkIncludeAnnotation` is `true` (default: false), set `splunk.com/include` annotation to `true` on pod and/or namespace to only include its logs from ingested. All other logs will be ignored.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,41 @@ data:
- sources:
- from: resource_attribute
name: host.name
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata:
- k8s.node.name
- k8s.namespace.name
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.pod.name
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
- sources:
- from: resource_attribute
name: host.name
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -423,6 +458,7 @@ data:
- batch
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- hostmetrics
- kubeletstats
Expand All @@ -438,6 +474,7 @@ data:
- resource/add_agent_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/agent
traces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,41 @@ data:
processors:
batch:
send_batch_max_size: 32768
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata:
- k8s.node.name
- k8s.namespace.name
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.pod.name
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
- sources:
- from: resource_attribute
name: host.name
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -91,6 +126,7 @@ data:
- memory_limiter
- batch
- resource
- k8sattributes/metrics
- resource/k8s_cluster
receivers:
- k8s_cluster
Expand All @@ -103,6 +139,7 @@ data:
- resource/add_collector_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/k8s_cluster_receiver
telemetry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
component: otel-collector-agent
release: default
annotations:
checksum/config: 2ed8cac6190f5e6b4d88c2a41231a6e7e939e4bf0acdf70d7d55583aa56c3a71
checksum/config: 46c8776094c22cf8f60598bb9069910465d828a412b0099b0d290d80dc058b9c
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
component: otel-k8s-cluster-receiver
release: default
annotations:
checksum/config: 14367a1254370c5fdbac0ebb1def583bdea4f355fae06dcc22e2dfb8ed5f5320
checksum/config: b8db287faad50b645d649c5fcc2d6be4601eae56a2921d5ecc186646505b99b5
spec:
serviceAccountName: default-splunk-otel-collector
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,41 @@ data:
- sources:
- from: resource_attribute
name: host.name
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
sbylica-splunk marked this conversation as resolved.
Show resolved Hide resolved
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata:
- k8s.node.name
- k8s.namespace.name
sbylica-splunk marked this conversation as resolved.
Show resolved Hide resolved
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
sbylica-splunk marked this conversation as resolved.
Show resolved Hide resolved
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.pod.name
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
- sources:
- from: resource_attribute
name: host.name
sbylica-splunk marked this conversation as resolved.
Show resolved Hide resolved
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -377,6 +412,7 @@ data:
- batch
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- kafkametrics
metrics/agent:
Expand All @@ -388,6 +424,7 @@ data:
- resource/add_agent_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/agent
traces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,41 @@ data:
processors:
batch:
send_batch_max_size: 32768
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata:
- k8s.node.name
- k8s.namespace.name
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.pod.name
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
- sources:
- from: resource_attribute
name: host.name
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -91,6 +126,7 @@ data:
- memory_limiter
- batch
- resource
- k8sattributes/metrics
- resource/k8s_cluster
receivers:
- k8s_cluster
Expand All @@ -103,6 +139,7 @@ data:
- resource/add_collector_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/k8s_cluster_receiver
telemetry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
component: otel-collector-agent
release: default
annotations:
checksum/config: f17b83e48bb335a2bdc8eaae8e7599f35a9aaa91ac4255582c4351fdbba7803e
checksum/config: a70bf6c522e43122ba87a20565dc4e59f485bef948eecc71f470f1a7d02671e7
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
component: otel-k8s-cluster-receiver
release: default
annotations:
checksum/config: 14367a1254370c5fdbac0ebb1def583bdea4f355fae06dcc22e2dfb8ed5f5320
checksum/config: b8db287faad50b645d649c5fcc2d6be4601eae56a2921d5ecc186646505b99b5
spec:
serviceAccountName: default-splunk-otel-collector
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,41 @@ data:
- sources:
- from: resource_attribute
name: host.name
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata:
- k8s.node.name
- k8s.namespace.name
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.pod.name
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
- sources:
- from: resource_attribute
name: host.name
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -251,6 +286,7 @@ data:
- batch
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- hostmetrics
- kubeletstats
Expand All @@ -266,6 +302,7 @@ data:
- resource/add_agent_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/agent
traces:
Expand Down
Loading
Loading