Skip to content

Commit 72b28c9

Browse files
fixing missing logs while pod log file being rolled over
1 parent 0fee859 commit 72b28c9

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: bug_fix
3+
# The name of the component, or a single word describing the area of concern, (e.g. agent, clusterReceiver, gateway, operator, chart, other)
4+
component: agent
5+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
6+
note: a fix for a scenario where some logs might be missed due to the pod log file being rolled over during high load, set featureGates.fixMissedLogsDuringLogRotation to true to enable the fix
7+
# One or more tracking issues related to the change
8+
issues: [1690]
9+
# (Optional) One or more lines of additional information to render under the primary note.
10+
# These lines will be padded with 2 spaces and then inserted directly into the document.
11+
# Use pipe (|) for multiline entries.
12+
subtext:

helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,31 @@ receivers:
410410
{{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "otel") }}
411411
{{- if .Values.logsCollection.containers.enabled }}
412412
filelog:
413+
{{- if not .Values.featureGates.fixMissedLogsDuringLogRotation }}
413414
{{- if .Values.isWindows }}
414415
include: ["C:\\var\\log\\pods\\*\\*\\*.log"]
415416
{{- else }}
416417
include: ["/var/log/pods/*/*/*.log"]
417418
{{- end }}
419+
{{- else }}
420+
{{- if .Values.isWindows }}
421+
include: ["C:\\var\\log\\pods\\*\\*\\*.log*"]
422+
{{- else }}
423+
include: ["/var/log/pods/*/*/*.log*"]
424+
{{- end }}
425+
{{- end }}
418426
# Exclude logs. The file format is
419427
# /var/log/pods/<namespace_name>_<pod_name>_<pod_uid>/<container_name>/<restart_count>.log
420428
exclude:
429+
{{- if .Values.featureGates.fixMissedLogsDuringLogRotation }}
430+
{{- if .Values.isWindows }}
431+
- "C:\\var\\log\\pods\\*\\*\\*.log*.gz"
432+
- "C:\\var\\log\\pods\\*\\*\\*.log*.tmp"
433+
{{- else }}
434+
- "/var/log/pods/*/*/*.log*.gz"
435+
- "/var/log/pods/*/*/*.log*.tmp"
436+
{{- end }}
437+
{{- end }}
421438
{{- if .Values.logsCollection.containers.excludeAgentLogs }}
422439
{{- if .Values.isWindows }}
423440
- "C:\\var\\log\\pods\\{{ template "splunk-otel-collector.namespace" . }}_{{ include "splunk-otel-collector.fullname" . }}*_*\\otel-collector\\*.log"
@@ -516,11 +533,19 @@ receivers:
516533
value: ""
517534
# Extract metadata from file path
518535
- type: regex_parser
536+
{{- if not .Values.featureGates.fixMissedLogsDuringLogRotation }}
519537
{{- if .Values.isWindows }}
520538
regex: '^C:\\var\\log\\pods\\(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[^\/]+)\\(?P<container_name>[^\._]+)\\(?P<restart_count>\d+)\.log$'
521539
{{- else }}
522540
regex: '^\/var\/log\/pods\/(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[^\/]+)\/(?P<container_name>[^\._]+)\/(?P<restart_count>\d+)\.log$'
523541
{{- end }}
542+
{{- else }}
543+
{{- if .Values.isWindows }}
544+
regex: '^C:\\var\\log\\pods\\(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[^\/]+)\\(?P<container_name>[^\._]+)\\(?P<restart_count>\d+)\.log'
545+
{{- else }}
546+
regex: '^\/var\/log\/pods\/(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[^\/]+)\/(?P<container_name>[^\._]+)\/(?P<restart_count>\d+)\.log'
547+
{{- end }}
548+
{{- end }}
524549
parse_from: attributes["log.file.path"]
525550
# Move out attributes to Attributes
526551
- type: move

helm-charts/splunk-otel-collector/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,3 +1387,6 @@ featureGates:
13871387
explicitMountServiceAccountToken: false
13881388
# Use a specific metrics pipeline to report control plane metrics as histograms.
13891389
useControlPlaneMetricsHistogramData: false
1390+
# The feature gate provides a fix for a scenario where some logs might be missed due to the pod log file being
1391+
# rolled over during high load.
1392+
fixMissedLogsDuringLogRotation: false

0 commit comments

Comments
 (0)