Skip to content

Commit

Permalink
use k8s.resource.name attribute for sourcetype
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit-splunk committed Jan 20, 2023
1 parent b8cc18e commit 00d0fde
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ processors:
log_statements:
- context: log
statements:
- set(resource.attributes["com.splunk.sourcetype"], Concat(["kube:object:", attributes["event.name"]], ""))
- set(resource.attributes["com.splunk.sourcetype"], Concat(["kube:object:", attributes["k8s.resource.name"]], ""))
{{- end }}

# Resource attributes specific to the collector itself.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ data:
- context: log
statements:
- set(resource.attributes["com.splunk.sourcetype"], Concat(["kube:object:",
attributes["event.name"]], ""))
attributes["k8s.resource.name"]], ""))
receivers:
k8s_cluster:
auth_type: serviceAccount
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: dc69aeb7ddf5ba0b1b1a5f994a735fdb8b0f1c951bd035444687a6e259ece306
checksum/config: b887031f92ae34e484cd4cc73a442dd1f077897614b7d31fc67918572913c447
spec:
serviceAccountName: default-splunk-otel-collector
nodeSelector:
Expand Down
6 changes: 3 additions & 3 deletions test/k8s_objects_tests/test_config_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def test_k8s_objects(setup, test_key, test_value, expected):
assert len(events) >= expected

@pytest.mark.parametrize("test_key, test_value, expected", [
("sourcetype", "kube:object:Pod", 1),
("sourcetype", "kube:object:namespace", 1),
("sourcetype", "kube:object:node", 1)
("sourcetype", "kube:object:pods", 1),
("sourcetype", "kube:object:namespaces", 1),
("sourcetype", "kube:object:nodes", 1)
])
def test_k8s_objects_sourcetype(setup, test_key, test_value, expected):
'''
Expand Down

0 comments on commit 00d0fde

Please sign in to comment.