Skip to content

Commit 4805fdc

Browse files
Fix default scan_frequency to 60s (#44304) (#44382)
(cherry picked from commit b6ce2c1) Co-authored-by: kaiyan-sheng <kaiyan.sheng@elastic.co>
1 parent 74c8625 commit 4805fdc

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

x-pack/filebeat/input/awscloudwatch/cloudwatch.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ func (p *cloudwatchPoller) getLogEventsFromCloudWatch(svc *cloudwatchlogs.Client
102102
}
103103

104104
func (p *cloudwatchPoller) constructFilterLogEventsInput(startTime, endTime time.Time, logGroupId string) *cloudwatchlogs.FilterLogEventsInput {
105+
p.log.Debugf("FilterLogEventsInput for log group: '%s' with startTime = '%v' and endTime = '%v'", logGroupId, unixMsFromTime(startTime), unixMsFromTime(endTime))
105106
filterLogEventsInput := &cloudwatchlogs.FilterLogEventsInput{
106107
LogGroupIdentifier: awssdk.String(logGroupId),
107108
StartTime: awssdk.Int64(unixMsFromTime(startTime)),

x-pack/filebeat/input/awscloudwatch/cloudwatch_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ func TestFilterLogEventsInput(t *testing.T) {
237237
},
238238
}
239239
for _, test := range testCases {
240-
p := cloudwatchPoller{}
240+
p := cloudwatchPoller{
241+
log: logp.NewLogger("test"),
242+
}
241243
result := p.constructFilterLogEventsInput(test.startTime, test.endTime, test.logGroupId)
242244
assert.Equal(t, test.expected, result)
243245
}

x-pack/filebeat/input/awscloudwatch/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func defaultConfig() config {
3636
Type: "aws-cloudwatch",
3737
},
3838
StartPosition: "beginning",
39-
ScanFrequency: 10 * time.Second,
39+
ScanFrequency: 60 * time.Second,
4040
APITimeout: 120 * time.Second,
4141
APISleep: 200 * time.Millisecond, // FilterLogEvents has a limit of 5 transactions per second (TPS)/account/Region: 1s / 5 = 200 ms
4242
NumberOfWorkers: 1,

x-pack/filebeat/input/awscloudwatch/input.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ func (in *cloudwatchInput) Run(inputContext v2.Context, pipeline beat.Pipeline)
124124
logProcessor := newLogProcessor(log.Named("log_processor"), in.metrics, client, ctx)
125125
cwPoller.metrics.logGroupsTotal.Add(uint64(len(logGroupIDs)))
126126
cwPoller.startWorkers(ctx, svc, logProcessor)
127+
128+
log.Debugf("Config latency = %f", cwPoller.config.Latency)
129+
log.Debugf("Config scan_frequency = %f", cwPoller.config.ScanFrequency)
130+
log.Debugf("Config api_sleep = %f", cwPoller.config.APISleep)
127131
cwPoller.receive(ctx, logGroupIDs, time.Now)
128132
return nil
129133
}

0 commit comments

Comments
 (0)