Skip to content

Commit 111b1db

Browse files
authored
filebeat: rename source log key to source_file (#30688)
Filebeat's logs were not fully compatible with ECS because some log entries were using `source` as string. This commit fixes it by rename `source` to `source_file`. Fixes: #30667
1 parent 0099f5c commit 111b1db

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...main[Check the HEAD dif
5858
- elasticsearch: fix duplicate ingest when using a common appender configuration {issue}30428[30428] {pull}30440[30440]
5959
- Fix ECS version string in threatintel to be consistent with other modules and add event.timezone. {issue}30499[30499] {pull}30570[30570]
6060
- Add default paths value to MySQL Enterprise module to prevent issues with pipeline installations {pull}30598[30598]
61+
- Fix compatibility with ECS by renaming `source` log key to `source_file` {issue}30667[30667]
6162

6263
*Heartbeat*
6364

filebeat/input/filestream/internal/input-logfile/harvester.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ type defaultHarvesterGroup struct {
141141
func (hg *defaultHarvesterGroup) Start(ctx input.Context, s Source) {
142142
sourceName := hg.identifier.ID(s)
143143

144-
ctx.Logger = ctx.Logger.With("source", sourceName)
144+
ctx.Logger = ctx.Logger.With("source_file", sourceName)
145145
ctx.Logger.Debug("Starting harvester for file")
146146

147147
hg.tg.Go(startHarvester(ctx, hg, s, false))
@@ -152,7 +152,7 @@ func (hg *defaultHarvesterGroup) Start(ctx input.Context, s Source) {
152152
func (hg *defaultHarvesterGroup) Restart(ctx input.Context, s Source) {
153153
sourceName := hg.identifier.ID(s)
154154

155-
ctx.Logger = ctx.Logger.With("source", sourceName)
155+
ctx.Logger = ctx.Logger.With("source_file", sourceName)
156156
ctx.Logger.Debug("Restarting harvester for file")
157157

158158
hg.tg.Go(startHarvester(ctx, hg, s, true))

filebeat/input/log/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
func loggerWithState(logger *logp.Logger, state file.State) *logp.Logger {
2626
return logger.With(
27-
"source", state.Source,
27+
"source_file", state.Source,
2828
"state_id", state.Id,
2929
"finished", state.Finished,
3030
"os_id", state.FileStateOS,

0 commit comments

Comments
 (0)