Skip to content

Commit 0a8c5b9

Browse files
committed
Refactor kubernetes autodiscover to avoid skipping short-living pods (#24742)
Refactor logic in kubernetes autodiscover that decides when to generate events to try to address issues with short-living containers. Kubernetes autodiscover can generate events without network information now (without host or port/ports). This allows to generate events for pods that haven't started yet, or have succeeded/failed before generating a running event. These events still include the container id, so they can be used to collect logs. Still, no start event is generated if no pod ip and no container ids are available. Some helpers have been added to obtain relevant information from pods and their containers. Some additional small refactors are done to improve readability. (cherry picked from commit b4b6e6e)
1 parent 04c62ef commit 0a8c5b9

6 files changed

Lines changed: 722 additions & 284 deletions

File tree

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
150150

151151
- Add `expand_keys` to the list of permitted config fields for `decode_json_fields` {24862}[24862]
152152
- Fix 'make setup' instructions for a new beat {pull}24944[24944]
153+
- Fix discovery of short-living and failing pods in Kubernetes autodiscover {issue}22718[22718] {pull}24742[24742]
153154
- Fix inode removal tracking code when files are replaced by files with the same name {pull}25002[25002]
154155
- Fix negative Kafka partition bug {pull}25048[25048]
155156
- Fix bug with annotations dedot config on k8s not used {pull}25111[25111]

filebeat/autodiscover/builder/hints/logs.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ func (l *logHints) CreateConfig(event bus.Event, options ...ucfg.Option) []*comm
9393
return []*common.Config{}
9494
}
9595

96-
host, _ := event["host"].(string)
97-
if host == "" {
98-
return []*common.Config{}
99-
}
100-
10196
if inputConfig != nil {
10297
configs := []*common.Config{}
10398
for _, cfg := range inputConfig {

0 commit comments

Comments
 (0)