Skip to content

Commit

Permalink
review suggestion
Browse files Browse the repository at this point in the history
Signed-off-by: Kavindu Dodanduwa <[email protected]>
  • Loading branch information
Kavindu-Dodan committed Oct 15, 2024
1 parent 396ddc9 commit 2d0b247
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@
#log_group_name: test

# The prefix for a group of log group names.
# You can include linked source accounts by using the property `linked_accounts_for_prefix_mode`.
# You can include linked source accounts by using the property `include_linked_accounts_for_prefix_mode`.
# Note: `region_name` is required when `log_group_name_prefix` is given.
# `log_group_name` and `log_group_name_prefix` cannot be given at the same time.
#log_group_name_prefix: /aws/

# State whether to include linked source accounts when obtaining log groups matching the prefix provided through `log_group_name_prefix`
# This property works together with `log_group_name_prefix` and default value (if unset) is false
#linked_accounts_for_prefix_mode: true
#include_linked_accounts_for_prefix_mode: true

# Region that the specified log group or log group prefix belongs to.
#region_name: us-east-1
Expand Down
4 changes: 2 additions & 2 deletions x-pack/filebeat/docs/inputs/input-aws-cloudwatch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ Note: `region_name` is required when log_group_name is given.

[float]
==== `log_group_name_prefix`
The prefix for a group of log group names. See `linked_accounts_for_prefix_mode` option for linked source accounts behavior.
The prefix for a group of log group names. See `include_linked_accounts_for_prefix_mode` option for linked source accounts behavior.

Note: `region_name` is required when
`log_group_name_prefix` is given. `log_group_name` and `log_group_name_prefix`
cannot be given at the same time. The number of workers that will process the
log groups under this prefix is set through the `number_of_workers` config.

[float]
==== `linked_accounts_for_prefix_mode`
==== `include_linked_accounts_for_prefix_mode`
Configure whether to include linked source accounts that contains the prefix value defined through `log_group_name_prefix`.
Accepts a boolean and this is by default disabled.

Expand Down
4 changes: 2 additions & 2 deletions x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3078,14 +3078,14 @@ filebeat.inputs:
#log_group_name: test

# The prefix for a group of log group names.
# You can include linked source accounts by using the property `linked_accounts_for_prefix_mode`.
# You can include linked source accounts by using the property `include_linked_accounts_for_prefix_mode`.
# Note: `region_name` is required when `log_group_name_prefix` is given.
# `log_group_name` and `log_group_name_prefix` cannot be given at the same time.
#log_group_name_prefix: /aws/

# State whether to include linked source accounts when obtaining log groups matching the prefix provided through `log_group_name_prefix`
# This property works together with `log_group_name_prefix` and default value (if unset) is false
#linked_accounts_for_prefix_mode: true
#include_linked_accounts_for_prefix_mode: true

# Region that the specified log group or log group prefix belongs to.
#region_name: us-east-1
Expand Down
30 changes: 15 additions & 15 deletions x-pack/filebeat/input/awscloudwatch/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ import (
)

type config struct {
harvester.ForwarderConfig `config:",inline"`
LogGroupARN string `config:"log_group_arn"`
LogGroupName string `config:"log_group_name"`
LogGroupNamePrefix string `config:"log_group_name_prefix"`
LinkedAccountsForPrefixMode *bool `config:"linked_accounts_for_prefix_mode"`
RegionName string `config:"region_name"`
LogStreams []*string `config:"log_streams"`
LogStreamPrefix string `config:"log_stream_prefix"`
StartPosition string `config:"start_position" default:"beginning"`
ScanFrequency time.Duration `config:"scan_frequency" validate:"min=0,nonzero"`
APITimeout time.Duration `config:"api_timeout" validate:"min=0,nonzero"`
APISleep time.Duration `config:"api_sleep" validate:"min=0,nonzero"`
Latency time.Duration `config:"latency"`
NumberOfWorkers int `config:"number_of_workers"`
AWSConfig awscommon.ConfigAWS `config:",inline"`
harvester.ForwarderConfig `config:",inline"`
LogGroupARN string `config:"log_group_arn"`
LogGroupName string `config:"log_group_name"`
LogGroupNamePrefix string `config:"log_group_name_prefix"`
IncludeLinkedAccountsForPrefixMode *bool `config:"include_linked_accounts_for_prefix_mode"`
RegionName string `config:"region_name"`
LogStreams []*string `config:"log_streams"`
LogStreamPrefix string `config:"log_stream_prefix"`
StartPosition string `config:"start_position" default:"beginning"`
ScanFrequency time.Duration `config:"scan_frequency" validate:"min=0,nonzero"`
APITimeout time.Duration `config:"api_timeout" validate:"min=0,nonzero"`
APISleep time.Duration `config:"api_sleep" validate:"min=0,nonzero"`
Latency time.Duration `config:"latency"`
NumberOfWorkers int `config:"number_of_workers"`
AWSConfig awscommon.ConfigAWS `config:",inline"`
}

func defaultConfig() config {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/filebeat/input/awscloudwatch/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (in *cloudwatchInput) Run(inputContext v2.Context, pipeline beat.Pipeline)
if len(logGroupIDs) == 0 {
// We haven't extracted group identifiers directly from the input configurations,
// now fallback to provided LogGroupNamePrefix and use derived service client to derive logGroupIDs
logGroupIDs, err = getLogGroupNames(svc, in.config.LogGroupNamePrefix, in.config.LinkedAccountsForPrefixMode)
logGroupIDs, err = getLogGroupNames(svc, in.config.LogGroupNamePrefix, in.config.IncludeLinkedAccountsForPrefixMode)
if err != nil {
return fmt.Errorf("failed to get log group names from LogGroupNamePrefix: %w", err)
}
Expand Down

0 comments on commit 2d0b247

Please sign in to comment.