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 journald config #290

Merged
merged 62 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
b2efe02
added journald config to olly chart
luckyj5 Nov 16, 2021
e00da4e
update values.yaml
luckyj5 Nov 16, 2021
b06d27b
render update
luckyj5 Nov 16, 2021
4f4ebf6
Merge branch 'main' into add-journald-config
luckyj5 Nov 16, 2021
4a6e6f1
render update2
luckyj5 Nov 16, 2021
18e1da9
updated conditional logic in the chart for journald receiver
luckyj5 Nov 16, 2021
1e0fda4
updated if/else condition for journald config
luckyj5 Nov 17, 2021
c5fd2e7
Merge branch 'main' into add-journald-config
luckyj5 Nov 17, 2021
5eb3aec
update render
luckyj5 Nov 17, 2021
36d15ac
added journald config to olly chart
luckyj5 Nov 16, 2021
300e409
render update
luckyj5 Nov 16, 2021
29db45e
merge
luckyj5 Nov 25, 2021
10d6db4
render update
luckyj5 Nov 25, 2021
0d6f56d
update values
luckyj5 Nov 25, 2021
c4f49fd
update based on PR review
luckyj5 Dec 7, 2021
e87e54e
render update
luckyj5 Dec 7, 2021
95d94ab
update based on PR review
luckyj5 Nov 25, 2021
257801f
merge latest changes
luckyj5 Dec 7, 2021
0457640
fix linting errors
luckyj5 Dec 7, 2021
af8630e
Merge branch 'signalfx:main' into add-journald-config
luckyj5 Dec 7, 2021
d69fccf
Update values.yaml
luckyj5 Dec 7, 2021
a40a460
Merge remote-tracking branch 'upstream/main' into add-journald-config
luckyj5 Dec 9, 2021
6ecc917
update render
luckyj5 Dec 9, 2021
5d52dcb
Merge branch 'signalfx:main' into add-journald-config
luckyj5 Dec 13, 2021
3651170
Merge branch 'signalfx:main' into add-journald-config
luckyj5 Dec 13, 2021
bd8bcd8
Merge remote-tracking branch 'upstream/main' into add-journald-config
luckyj5 Dec 13, 2021
52d9a82
update render
luckyj5 Dec 13, 2021
2b7ad93
Squashed commit of the following:
luckyj5 Dec 13, 2021
17c6961
update render
luckyj5 Dec 13, 2021
7b766d0
Merge remote-tracking branch 'upstream/main' into add-journald-config
luckyj5 Dec 13, 2021
750dc2b
update render
luckyj5 Dec 13, 2021
285fd78
Merge branch 'signalfx:main' into add-journald-config
luckyj5 Dec 13, 2021
2506114
Merge branch 'signalfx:main' into add-journald-config
luckyj5 Dec 14, 2021
adc8900
update agent template
luckyj5 Dec 15, 2021
c9cf143
added journald advance config section and changelog
luckyj5 Dec 15, 2021
cd58035
fix typo
luckyj5 Dec 15, 2021
d7e380a
Update helm-charts/splunk-otel-collector/templates/config/_otel-agent…
luckyj5 Dec 16, 2021
bc610c1
Update helm-charts/splunk-otel-collector/values.yaml
luckyj5 Dec 16, 2021
1ffdb1e
update per pr review
luckyj5 Dec 17, 2021
b031204
fix whitespace
luckyj5 Dec 17, 2021
6d09c72
update per review comments
luckyj5 Dec 21, 2021
e1bf0fc
update journal path directory default value
luckyj5 Dec 21, 2021
cbc6e1d
update render
luckyj5 Dec 21, 2021
8fa229a
Merge branch 'signalfx:main' into add-journald-config
luckyj5 Dec 21, 2021
ec70eb6
update closing tags
luckyj5 Dec 23, 2021
f3bf62f
update template
luckyj5 Dec 23, 2021
fe2743a
update render
luckyj5 Dec 23, 2021
a91a15e
added filter to discard not useful fields
luckyj5 Jan 5, 2022
d6f660b
move MESSAGE to log body and priority & unit to attributes
luckyj5 Jan 19, 2022
fb435da
update render
luckyj5 Jan 19, 2022
e17098f
Merge branch 'main' into add-journald-config
luckyj5 Jan 19, 2022
721fe21
update render
luckyj5 Jan 19, 2022
3b7e3c8
update Changelog
luckyj5 Jan 19, 2022
69b2175
update comments
luckyj5 Jan 19, 2022
44cd758
udpate to remove unit-name when its not present
luckyj5 Jan 19, 2022
6fc8e8b
udpate default units value and disable journald by default
luckyj5 Jan 20, 2022
5482e07
Merge branch 'signalfx:main' into add-journald-config
luckyj5 Jan 20, 2022
eeceaf1
Update CHANGELOG.md
luckyj5 Jan 20, 2022
5641b2f
update docs and clean up
luckyj5 Jan 20, 2022
88547b3
update render
luckyj5 Jan 20, 2022
5996f07
update journald sourcetype format to be consistent with other sourcet…
luckyj5 Jan 20, 2022
6026b7b
update schema for units object
luckyj5 Jan 20, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

- Journald support (#290)
luckyj5 marked this conversation as resolved.
Show resolved Hide resolved
- Auto collect metrics for the apiserver control plane component
- Add native OTel logs collection for the Windows node (#361)

Expand Down
23 changes: 23 additions & 0 deletions docs/advanced-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,29 @@ logsCollection:

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`.


### Collect journald events

Splunk OpenTelemetry Collector for Kubernetes can collect journald events from kubernetes environment.
Process journald events by configuring `logsCollection.journald` section in values.yaml.

```yaml
logsCollection:
journald:
enabled: true
directory: /run/log/journal
# List of service units to collect and configuration for each. Please update the list as needed.
units:
- name: kubelet
priority: info
- name: docker
priority: info
- name: containerd
priority: info
# Route journald logs to its own Splunk Index by specifying the index value below, else leave it blank. Please make sure the index exist in Splunk and is configured to receive HEC traffic.
dmitryax marked this conversation as resolved.
Show resolved Hide resolved
index: ""
```

### Performance of native OpenTelemetry logs collection

Some configurations used with the OpenTelemetry Collector (as set using the Splunk OpenTelemetry Collector for Kubernetes helm chart) can have an impact on overall performance of log ingestion. The more receivers, processors, exporters, and extensions that are added to any of the pipelines, the greater the performance impact.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ receivers:
listenAddress: 0.0.0.0:9080
{{- end }}

{{- if and (eq .Values.logsEngine "otel") .Values.logsCollection.containers.enabled }}
{{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "otel") }}
{{- if .Values.logsCollection.containers.enabled }}
filelog:
{{- if .Values.isWindows }}
include: ["C:\\var\\log\\pods\\*\\*\\*.log"]
Expand Down Expand Up @@ -272,10 +273,38 @@ receivers:
- move:
from: log
to: $$
{{- end }}

dmitryax marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.logsCollection.extraFileLogs }}
{{- toYaml .Values.logsCollection.extraFileLogs | nindent 2 }}
{{- end }}

# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/journaldreceiver
{{- if .Values.logsCollection.journald.enabled }}
{{- range $_, $unit := .Values.logsCollection.journald.units }}
{{- printf "journald/%s:" $unit.name | nindent 2 }}
directory: {{ $.Values.logsCollection.journald.directory }}
units: [{{ $unit.name }}]
priority: {{ $unit.priority }}
operators:
- type: metadata
resource:
com.splunk.source: {{ $.Values.logsCollection.journald.directory }}
com.splunk.sourcetype: 'EXPR("kube:"+$$._SYSTEMD_UNIT)'
dmitryax marked this conversation as resolved.
Show resolved Hide resolved
com.splunk.index: {{ $.Values.logsCollection.journald.index | default $.Values.splunkPlatform.index}}
host.name: 'EXPR(env("K8S_NODE_NAME"))'
# adding journald priority and unit as attributes
journald.priority.number: 'EXPR($$.PRIORITY)'
journald.unit.name: 'EXPR($$._SYSTEMD_UNIT)'
# extract MESSAGE field into the log body and discard rest of the fields
- type: restructure
id: set-body
ops:
- move:
from: MESSAGE
to: $$
{{- end }}
{{- end }}
dmitryax marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}

dmitryax marked this conversation as resolved.
Show resolved Hide resolved
# By default k8sattributes and batch processors enabled.
Expand Down Expand Up @@ -499,12 +528,19 @@ service:
{{- end }}
{{- end }}

{{- if .Values.logsCollection.extraFileLogs }}
logs/extraFiles:
{{- if and (eq .Values.logsEngine "otel") (or .Values.logsCollection.extraFileLogs .Values.logsCollection.journald.enabled) }}
logs/host:
receivers:
{{- if .Values.logsCollection.extraFileLogs }}
{{- range $key, $exporterData := .Values.logsCollection.extraFileLogs }}
- {{ $key }}
{{ end }}
{{- end }}
{{- end }}
{{- if (.Values.logsCollection.journald.enabled)}}
{{- range $_, $unit := .Values.logsCollection.journald.units }}
{{- printf "- journald/%s" $unit.name | nindent 8 }}
{{- end }}
{{- end }}
dmitryax marked this conversation as resolved.
Show resolved Hide resolved
processors:
- memory_limiter
- batch
Expand All @@ -519,7 +555,7 @@ service:
{{- if eq (include "splunk-otel-collector.o11yLogsEnabled" .) "true" }}
- splunk_hec/o11y
{{- end }}
{{- end }}
{{- end }}
{{- end }}

dmitryax marked this conversation as resolved.
Show resolved Hide resolved
{{- if (eq (include "splunk-otel-collector.tracesEnabled" .) "true") }}
Expand Down
14 changes: 14 additions & 0 deletions helm-charts/splunk-otel-collector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,11 @@ spec:
{{- end }}
- name: checkpoint
mountPath: {{ .Values.logsCollection.checkpointPath }}
{{- if .Values.logsCollection.journald.enabled}}
- mountPath: {{.Values.logsCollection.journald.directory}}
name: journaldlogs
readOnly: true
{{- end }}
{{- end }}
{{- if $agent.extraVolumeMounts }}
{{- toYaml $agent.extraVolumeMounts | nindent 8 }}
Expand Down Expand Up @@ -416,6 +421,15 @@ spec:
hostPath:
path: {{ .Values.logsCollection.checkpointPath }}
type: DirectoryOrCreate
{{- if .Values.logsCollection.journald.enabled}}
- name: journaldlogs
hostPath:
path: {{.Values.logsCollection.journald.directory}}
{{- end}}
- name: old-checkpoint
hostPath:
path: /var/lib/otel_pos
type: DirectoryOrCreate
dmitryax marked this conversation as resolved.
Show resolved Hide resolved
{{- end}}
{{- end}}
{{- if eq (include "splunk-otel-collector.metricsEnabled" $) "true" }}
Expand Down
22 changes: 22 additions & 0 deletions helm-charts/splunk-otel-collector/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,28 @@
}
}
},
"journald": {
"description": "Configuration to collect journald logs",
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"directory": {
"type": "string"
},
"index": {
"type": "string"
},
"units": {
"type": "array",
"items": {
"type": "object"
dmitryax marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
},
"checkpointPath": {
"type": "string"
},
Expand Down
16 changes: 16 additions & 0 deletions helm-charts/splunk-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,22 @@ logsCollection:
# All other logs will be ignored.
useSplunkIncludeAnnotation: false

# Configuration for collecting journald logs using otel collector
journald:
enabled: false
# Please update directory path for journald if it's different from below default value "/var/log/journal"
directory: /var/log/journal
# List of service units to collect journald logs for and configuration for each.
units:
- name: kubelet
priority: info
- name: docker
priority: info
- name: containerd
priority: info
# Route journald logs to its own Splunk Index by specifying the index value below, else leave it blank. Please make sure the index exist in Splunk and is configured to receive HEC traffic. Not applicable to Splunk Observability.
index: ""

checkpointPath: "/var/addon/splunk/otel_pos"

# Files on k8s nodes to tail.
Expand Down
4 changes: 4 additions & 0 deletions rendered/manifests/otel-logs/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ spec:
hostPath:
path: /var/addon/splunk/otel_pos
type: DirectoryOrCreate
- name: old-checkpoint
hostPath:
path: /var/lib/otel_pos
type: DirectoryOrCreate
- name: host-dev
hostPath:
path: /dev
Expand Down