Skip to content

Fix default scan_frequency to 60s #44304

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

Merged
merged 3 commits into from
May 19, 2025
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
1 change: 1 addition & 0 deletions x-pack/filebeat/input/awscloudwatch/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (p *cloudwatchPoller) getLogEventsFromCloudWatch(svc *cloudwatchlogs.Client
}

func (p *cloudwatchPoller) constructFilterLogEventsInput(startTime, endTime time.Time, logGroupId string) *cloudwatchlogs.FilterLogEventsInput {
p.log.Debugf("FilterLogEventsInput for log group: '%s' with startTime = '%v' and endTime = '%v'", logGroupId, unixMsFromTime(startTime), unixMsFromTime(endTime))
filterLogEventsInput := &cloudwatchlogs.FilterLogEventsInput{
LogGroupIdentifier: awssdk.String(logGroupId),
StartTime: awssdk.Int64(unixMsFromTime(startTime)),
Expand Down
4 changes: 3 additions & 1 deletion x-pack/filebeat/input/awscloudwatch/cloudwatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ func TestFilterLogEventsInput(t *testing.T) {
},
}
for _, test := range testCases {
p := cloudwatchPoller{}
p := cloudwatchPoller{
log: logp.NewLogger("test"),
}
result := p.constructFilterLogEventsInput(test.startTime, test.endTime, test.logGroupId)
assert.Equal(t, test.expected, result)
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/filebeat/input/awscloudwatch/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func defaultConfig() config {
Type: "aws-cloudwatch",
},
StartPosition: "beginning",
ScanFrequency: 10 * time.Second,
ScanFrequency: 60 * time.Second,
APITimeout: 120 * time.Second,
APISleep: 200 * time.Millisecond, // FilterLogEvents has a limit of 5 transactions per second (TPS)/account/Region: 1s / 5 = 200 ms
NumberOfWorkers: 1,
Expand Down
4 changes: 4 additions & 0 deletions x-pack/filebeat/input/awscloudwatch/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ func (in *cloudwatchInput) Run(inputContext v2.Context, pipeline beat.Pipeline)
logProcessor := newLogProcessor(log.Named("log_processor"), in.metrics, client, ctx)
cwPoller.metrics.logGroupsTotal.Add(uint64(len(logGroupIDs)))
cwPoller.startWorkers(ctx, svc, logProcessor)

log.Debugf("Config latency = %f", cwPoller.config.Latency)
log.Debugf("Config scan_frequency = %f", cwPoller.config.ScanFrequency)
log.Debugf("Config api_sleep = %f", cwPoller.config.APISleep)
cwPoller.receive(ctx, logGroupIDs, time.Now)
return nil
}
Expand Down