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

add combineWith to multiline options #993

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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/recombine_with_field.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: agent
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add combineWith field to multiline configuration
# One or more tracking issues related to the change
issues: [756]
# (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 @@ -474,6 +474,7 @@ logsCollection:
containerName:
value: server
firstEntryRegex: ^[^\s].*
combineWith: ""
atoulme marked this conversation as resolved.
Show resolved Hide resolved
```

Use https://regex101.com/ to find a golang regex that works for your format and specify it in the config file for the config option `firstEntryRegex`.
Expand Down
30 changes: 30 additions & 0 deletions examples/only-logs-otel/only-logs-otel-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,33 @@ splunkObservability:
tracesEnabled: false

logsEngine: otel
logsCollection:
containers:
multilineConfigs:
- namespaceName:
value: default
podName:
value: buttercup-app-.*
useRegexp: true
containerName:
value: server
firstEntryRegex: ^[^\s].*
combineWith: "\t" # Recombine entries together with a tab character.
- namespaceName:
value: k8s-nm2
podName:
value: foo-app-.*
useRegexp: true
containerName:
value: client
firstEntryRegex: ^[^\s].*
combineWith: "" # Recombine entries without a separator.
- namespaceName:
value: k8s-nm3
podName:
value: foo-app-.*
useRegexp: true
containerName:
value: server
firstEntryRegex: ^[^\s].*
# Recombine entries with the default separator, "\n".
35 changes: 35 additions & 0 deletions examples/only-logs-otel/rendered_manifests/configmap-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,41 @@ data:
- from: attributes["log.file.path"]
to: resource["com.splunk.source"]
type: move
- default: clean-up-log-record
routes:
- expr: (resource["k8s.namespace.name"]) == "default" && (resource["k8s.pod.name"])
matches "buttercup-app-.*" && (resource["k8s.container.name"]) == "server"
output: default_buttercup-app-.*_server
- expr: (resource["k8s.namespace.name"]) == "k8s-nm2" && (resource["k8s.pod.name"])
matches "foo-app-.*" && (resource["k8s.container.name"]) == "client"
output: k8s-nm2_foo-app-.*_client
- expr: (resource["k8s.namespace.name"]) == "k8s-nm3" && (resource["k8s.pod.name"])
matches "foo-app-.*" && (resource["k8s.container.name"]) == "server"
output: k8s-nm3_foo-app-.*_server
type: router
- combine_field: attributes.log
combine_with: "\t"
id: default_buttercup-app-.*_server
is_first_entry: (attributes.log) matches "^[^\\s].*"
max_log_size: 1048576
output: clean-up-log-record
source_identifier: resource["com.splunk.source"]
type: recombine
- combine_field: attributes.log
combine_with: ""
id: k8s-nm2_foo-app-.*_client
is_first_entry: (attributes.log) matches "^[^\\s].*"
max_log_size: 1048576
output: clean-up-log-record
source_identifier: resource["com.splunk.source"]
type: recombine
- combine_field: attributes.log
id: k8s-nm3_foo-app-.*_server
is_first_entry: (attributes.log) matches "^[^\\s].*"
max_log_size: 1048576
output: clean-up-log-record
source_identifier: resource["com.splunk.source"]
type: recombine
- from: attributes.log
id: clean-up-log-record
to: body
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: 82c6445c679f194d080fa8bd2763321f93e84c16fa3cb7217750960f4348e1ee
checksum/config: 4f78d6630e152af9891dda63bcdfc713718524850c2de9794b88ba005c4875ec
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ receivers:
combine_field: attributes.log
is_first_entry: '(attributes.log) matches {{ .firstEntryRegex | quote }}'
max_log_size: {{ $.Values.logsCollection.containers.maxRecombineLogSize }}
{{- if hasKey . "combineWith" }}
combine_with: {{ .combineWith | quote }}
{{- end }}
{{- end }}
{{- end }}
# Clean up log record
Expand Down
1 change: 1 addition & 0 deletions helm-charts/splunk-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ logsCollection:
# containerName:
# value: server
# firstEntryRegex: ^[^\s].*
# combineWith: ""
multilineConfigs: []
# Set useSplunkIncludeAnnotation flag to `true` to collect logs from pods with `splunk.com/include: true` annotation and ignore others.
# All other logs will be ignored.
Expand Down
Loading