Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
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
3 changes: 3 additions & 0 deletions e2e/_suites/kubernetes-autodiscover/autodiscover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,9 @@ func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^"([^"]*)" is ([a-z]*) with "([^"]*)"$`, func(name, state, option string) error {
return pods.resourceIs(name, state, option)
})
ctx.Step(`^"([^"]*)" is ([a-z]*) with "([^"]*)" and "([^"]*)"$`, func(name, state, option1, option2 string) error {
return pods.resourceIs(name, state, option1, option2)
})

ctx.Step(`^"([^"]*)" collects events with "([^"]*:[^"]*)"$`, pods.collectsEventsWith)
ctx.Step(`^"([^"]*)" does not collect events with "([^"]*)" during "([^"]*)"$`, pods.doesNotCollectEvents)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ Scenario: Logs collection from a pod with an ephemeral container
When an ephemeral container is started in "a pod"
Then "filebeat" collects events with "kubernetes.container.name:ephemeral-container"

# Running autodiscover with add_kubernetes_metadata is not recommended because both
# features add the same metadata, but there is nothing preventing this config.
Scenario: Logs collection from running pod and metadata enrichment using add_kubernetes_metadata
Given "filebeat" is running with "hints enabled" and "add_kubernetes_metadata"
When "a pod" is deployed
Then "filebeat" collects events with "kubernetes.pod.name:a-pod"

# Not really autodiscover, but this is a frequent use case in autodiscover-like
# scenarios for logs collection.
Scenario: Enrichment of normal input using add_kubernetes_metadata
Given "filebeat" is running with "input and add_kubernetes_metadata"
Given "filebeat" is running with "input with add_kubernetes_metadata"
When "a pod" is deployed
Then "filebeat" collects events with "kubernetes.pod.name:a-pod"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
k8s-app: filebeat
data:
filebeat.yml: |-
{{ if option "input and add_kubernetes_metadata" }}
{{ if option "input with add_kubernetes_metadata" }}
filebeat.inputs:
- type: container
paths:
Expand All @@ -31,6 +31,14 @@ data:
paths:
- /var/log/containers/*${data.kubernetes.container.id}.log
{{ end }}
{{ end }}
{{ if option "add_kubernetes_metadata" }}
processors:
- add_kubernetes_metadata:
host: ${NODE_NAME}
matchers:
- logs_path:
logs_path: "/var/log/containers/"
{{ end }}

output.file:
Expand Down