Skip to content

Commit 5c0807f

Browse files
authored
Merge branch 'main' into go-1.23.2
2 parents d88f99c + 488c445 commit 5c0807f

22 files changed

+1934
-155
lines changed

CHANGELOG-developer.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only.
205205
- Add a configuration option for TCP/UDP network type. {issue}40407[40407] {pull}40623[40623]
206206
- Added debug logging to parquet reader in x-pack/libbeat/reader. {pull}40651[40651]
207207
- Added filebeat debug histograms for s3 object size and events per processed s3 object. {pull}40775[40775]
208+
- Simplified GCS input state checkpoint calculation logic. {issue}40878[40878] {pull}40937[40937]
208209
- Simplified Azure Blob Storage input state checkpoint calculation logic. {issue}40674[40674] {pull}40936[40936]
209210

210211
==== Deprecated

CHANGELOG.next.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
311311
- Make HTTP library function inclusion non-conditional in CEL input. {pull}40912[40912]
312312
- Add support for Crowdstrike streaming API to the streaming input. {issue}40264[40264] {pull}40838[40838]
313313
- Add support to CEL for reading host environment variables. {issue}40762[40762] {pull}40779[40779]
314+
- Add CSV decoder to awss3 input. {pull}40896[40896]
314315

315316
*Auditbeat*
316317

@@ -344,6 +345,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
344345
- Add new metricset cluster for the vSphere module. {pull}40536[40536]
345346
- Add new metricset network for the vSphere module. {pull}40559[40559]
346347
- Add new metricset resourcepool for the vSphere module. {pull}40456[40456]
348+
- Add AWS Cloudwatch capability to retrieve tags from AWS/ApiGateway resources {pull}40755[40755]
347349
- Add new metricset datastorecluster for vSphere module. {pull}40634[40634]
348350
- Add support for new metrics in datastorecluster metricset. {pull}40694[40694]
349351
- Add new metrics for the vSphere Virtualmachine metricset. {pull}40485[40485]

NOTICE.txt

Lines changed: 654 additions & 18 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/apoydence/eachers v0.0.0-20181020210610-23942921fe77 // indirect
2828
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
2929
github.com/aws/aws-lambda-go v1.44.0
30-
github.com/aws/aws-sdk-go-v2 v1.30.4
30+
github.com/aws/aws-sdk-go-v2 v1.30.5
3131
github.com/aws/aws-sdk-go-v2/config v1.27.29
3232
github.com/aws/aws-sdk-go-v2/credentials v1.17.29
3333
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.40.5
@@ -179,8 +179,11 @@ require (
179179
github.com/Azure/azure-storage-blob-go v0.15.0
180180
github.com/Azure/go-autorest/autorest/adal v0.9.24
181181
github.com/apache/arrow/go/v14 v14.0.2
182+
github.com/aws/aws-sdk-go v1.54.19
182183
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12
183184
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.13
185+
github.com/aws/aws-sdk-go-v2/service/apigateway v1.25.8
186+
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.22.8
184187
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.53.5
185188
github.com/aws/aws-sdk-go-v2/service/health v1.26.4
186189
github.com/aws/aws-sdk-go-v2/service/kinesis v1.29.5
@@ -255,8 +258,8 @@ require (
255258
github.com/apache/thrift v0.19.0 // indirect
256259
github.com/armon/go-radix v1.0.0 // indirect
257260
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4 // indirect
258-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 // indirect
259-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 // indirect
261+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 // indirect
262+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 // indirect
260263
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
261264
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16 // indirect
262265
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect

go.sum

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
158158
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
159159
github.com/aws/aws-lambda-go v1.44.0 h1:Xp9PANXKsSJ23IhE4ths592uWTCEewswPhSH9qpAuQQ=
160160
github.com/aws/aws-lambda-go v1.44.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7RfgJv23DymV8A=
161+
github.com/aws/aws-sdk-go v1.54.19 h1:tyWV+07jagrNiCcGRzRhdtVjQs7Vy41NwsuOcl0IbVI=
162+
github.com/aws/aws-sdk-go v1.54.19/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
161163
github.com/aws/aws-sdk-go-v2 v1.9.0/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4=
162-
github.com/aws/aws-sdk-go-v2 v1.30.4 h1:frhcagrVNrzmT95RJImMHgabt99vkXGslubDaDagTk8=
163-
github.com/aws/aws-sdk-go-v2 v1.30.4/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0=
164+
github.com/aws/aws-sdk-go-v2 v1.30.5 h1:mWSRTwQAb0aLE17dSzztCVJWI9+cRMgqebndjwDyK0g=
165+
github.com/aws/aws-sdk-go-v2 v1.30.5/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0=
164166
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4 h1:70PVAiL15/aBMh5LThwgXdSQorVr91L127ttckI9QQU=
165167
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4/go.mod h1:/MQxMqci8tlqDH+pjmoLu1i0tbWCUP1hhyMRuFxpQCw=
166168
github.com/aws/aws-sdk-go-v2/config v1.27.29 h1:+ZPKb3u9Up4KZWLGTtpTmC5T3XmRD1ZQ8XQjRCHUvJw=
@@ -171,14 +173,18 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 h1:yjwoSyDZF8Jth+mUk5lSPJ
171173
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12/go.mod h1:fuR57fAgMk7ot3WcNQfb6rSEn+SUffl7ri+aa8uKysI=
172174
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.13 h1:X8EeaOjl91c8sP14NG8EHx5ZxXLJg0tHDp+KQSghp28=
173175
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.13/go.mod h1:kEI/h2bETfm09LSd7xEEH2qcU1cd//+5HH4Le7p9JgY=
174-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 h1:TNyt/+X43KJ9IJJMjKfa3bNTiZbUP7DeCxfbTROESwY=
175-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16/go.mod h1:2DwJF39FlNAUiX5pAc0UNeiz16lK2t7IaFcm0LFHEgc=
176-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 h1:jYfy8UPmd+6kJW5YhY0L1/KftReOGxI/4NtVSTh9O/I=
177-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16/go.mod h1:7ZfEPZxkW42Afq4uQB8H2E2e6ebh6mXTueEpYzjCzcs=
176+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 h1:pI7Bzt0BJtYA0N/JEC6B8fJ4RBrEMi1LBrkMdFYNSnQ=
177+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17/go.mod h1:Dh5zzJYMtxfIjYW+/evjQ8uj2OyR/ve2KROHGHlSFqE=
178+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 h1:Mqr/V5gvrhA2gvgnF42Zh5iMiQNcOYthFYwCyrnuWlc=
179+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17/go.mod h1:aLJpZlCmjE+V+KtN1q1uyZkfnUWpQGpbsn89XPKyzfU=
178180
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ=
179181
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
180182
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16 h1:mimdLQkIX1zr8GIPY1ZtALdBQGxcASiBd2MOp8m/dMc=
181183
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.16/go.mod h1:YHk6owoSwrIsok+cAH9PENCOGoH5PU2EllX4vLtSrsY=
184+
github.com/aws/aws-sdk-go-v2/service/apigateway v1.25.8 h1:CgEyY7gfTf7lHYcCi7+w6jJ1XQBugjpadtsuN3TGxdQ=
185+
github.com/aws/aws-sdk-go-v2/service/apigateway v1.25.8/go.mod h1:z99ur4Ha5540t8hb5XtqV/UMOnEoEZK22lhr5ZBS0zw=
186+
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.22.8 h1:SWBNBbVbThg5Hdi3hWbVaDFjV/OyPbuqZLu4N+mj/Es=
187+
github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.22.8/go.mod h1:lz2IT8gzzSwao0Pa6uMSdCIPsprmgCkW83q6sHGZFDw=
182188
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.53.5 h1:YeTVIy7cJLeahs7K0jQGDGAd1YYND/to/z8N3kqZBhY=
183189
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.53.5/go.mod h1:y45SdA9v+dLlweaqwAQMoFeXqdRvgwevafa2X8iTqZQ=
184190
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.40.5 h1:/YvqO1j75i4leoV+Z3a5s/dAlEszf2wTKBW8jc3Gd4s=

metricbeat/docs/modules/aws.asciidoc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,25 @@ Enforces the use of FIPS service endpoints. See <<aws-credentials-config,AWS cre
146146
- ec2
147147
----
148148

149+
* *apigateway_max_results*
150+
151+
This configuration works together with AWS/APIGateway namespace. It defines the maximum number of returned results per page. The default value is 25 and the maximum value is 500.
152+
See https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/[email protected]#GetRestApisInput.Limit[GetRestApisInput.Limit]
153+
154+
[source,yaml]
155+
----
156+
- module: aws
157+
period: 10s
158+
regions:
159+
- us-east-1
160+
metricsets:
161+
- cloudwatch
162+
metrics:
163+
- namespace: "AWS/ApiGateway"
164+
resource_type: "apigateway:restapis"
165+
apigateway_max_results: 40
166+
----
167+
149168
The aws module comes with a predefined dashboard. For example:
150169

151170
image::./images/metricbeat-aws-overview.png[]

x-pack/filebeat/docs/inputs/input-aws-s3.asciidoc

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,28 +123,71 @@ The file decoding option is used to specify a codec that will be used to
123123
decode the file contents. This can apply to any file stream data.
124124
An example config is shown below:
125125

126+
Currently supported codecs are given below:-
127+
128+
1. <<attrib-decoding-csv,CSV>>: This codec decodes RFC 4180 CSV data streams.
129+
2. <<attrib-decoding-parquet,Parquet>>: This codec decodes parquet compressed data streams.
130+
131+
[id="attrib-decoding-csv"]
132+
[float]
133+
==== `the CSV codec`
134+
The `CSV` codec is used to decode RFC 4180 CSV data streams.
135+
Enabling the codec without other options will use the default codec options.
136+
126137
[source,yaml]
127138
----
128-
decoding.codec.parquet.enabled: true
129-
----
139+
decoding.codec.csv.enabled: true
140+
----
141+
142+
The CSV codec supports five sub attributes to control aspects of CSV decoding.
143+
The `comma` attribute specifies the field separator character used by the CSV
144+
format. If it is not specified, the comma character '`,`' is used. The `comment`
145+
attribute specifies the character that should be interpreted as a comment mark.
146+
If it is specified, lines starting with the character will be ignored. Both
147+
`comma` and `comment` must be single characters. The `lazy_quotes` attribute
148+
controls how quoting in fields is handled. If `lazy_quotes` is true, a quote may
149+
appear in an unquoted field and a non-doubled quote may appear in a quoted field.
150+
The `trim_leading_space` attribute specifies that leading white space should be
151+
ignored, even if the `comma` character is white space. For complete details
152+
of the preceding configuration attribute behaviors, see the CSV decoder
153+
https://pkg.go.dev/encoding/csv#Reader[documentation] The `fields_names`
154+
attribute can be used to specify the column names for the data. If it is
155+
absent, the field names are obtained from the first non-comment line of
156+
data. The number of fields must match the number of field names.
130157

131-
Currently supported codecs are given below:-
158+
An example config is shown below:
132159

133-
1. <<attrib-decoding-parquet,Parquet>>: This codec decodes parquet compressed data streams.
160+
[source,yaml]
161+
----
162+
decoding.codec.csv.enabled: true
163+
decoding.codec.csv.comma: "\t"
164+
decoding.codec.csv.comment: "#"
165+
----
134166

135167
[id="attrib-decoding-parquet"]
136168
[float]
137169
==== `the parquet codec`
138170
The `parquet` codec is used to decode parquet compressed data streams.
139-
Only enabling the codec will use the default codec options. The parquet codec supports
140-
two sub attributes which can make parquet decoding more efficient. The `batch_size` attribute and
141-
the `process_parallel` attribute. The `batch_size` attribute can be used to specify the number of
142-
records to read from the parquet stream at a time. By default the `batch size` is set to `1` and
143-
`process_parallel` is set to `false`. If the `process_parallel` attribute is set to `true` then functions
144-
which read multiple columns will read those columns in parallel from the parquet stream with a
145-
number of readers equal to the number of columns. Setting `process_parallel` to `true` will greatly
146-
increase the rate of processing at the cost of increased memory usage. Having a larger `batch_size`
147-
also helps to increase the rate of processing. An example config is shown below:
171+
Only enabling the codec will use the default codec options.
172+
173+
[source,yaml]
174+
----
175+
decoding.codec.parquet.enabled: true
176+
----
177+
178+
The parquet codec supports two sub attributes which can make parquet decoding
179+
more efficient. The `batch_size` attribute and the `process_parallel`
180+
attribute. The `batch_size` attribute can be used to specify the number of
181+
records to read from the parquet stream at a time. By default the `batch
182+
size` is set to `1` and `process_parallel` is set to `false`. If the
183+
`process_parallel` attribute is set to `true` then functions which read
184+
multiple columns will read those columns in parallel from the parquet stream
185+
with a number of readers equal to the number of columns. Setting
186+
`process_parallel` to `true` will greatly increase the rate of processing at
187+
the cost of increased memory usage. Having a larger `batch_size` also helps
188+
to increase the rate of processing.
189+
190+
An example config is shown below:
148191

149192
[source,yaml]
150193
----

x-pack/filebeat/input/awss3/decoding.go

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ package awss3
77
import (
88
"fmt"
99
"io"
10-
11-
"github.com/elastic/beats/v7/x-pack/libbeat/reader/parquet"
1210
)
1311

14-
// decoder is an interface for decoding data from an io reader.
12+
// decoder is an interface for decoding data from an io.Reader.
1513
type decoder interface {
1614
// decode reads and decodes data from an io reader based on the codec type.
1715
// It returns the decoded data and an error if the data cannot be decoded.
@@ -23,6 +21,13 @@ type decoder interface {
2321
close() error
2422
}
2523

24+
// valueDecoder is a decoder that can decode directly to a JSON serialisable value.
25+
type valueDecoder interface {
26+
decoder
27+
28+
decodeValue() (any, error)
29+
}
30+
2631
// newDecoder creates a new decoder based on the codec type.
2732
// It returns a decoder type and an error if the codec type is not supported.
2833
// If the reader config codec option is not set, it returns a nil decoder and nil error.
@@ -32,47 +37,9 @@ func newDecoder(config decoderConfig, r io.Reader) (decoder, error) {
3237
return nil, nil
3338
case config.Codec.Parquet != nil:
3439
return newParquetDecoder(config, r)
40+
case config.Codec.CSV != nil:
41+
return newCSVDecoder(config, r)
3542
default:
3643
return nil, fmt.Errorf("unsupported config value: %v", config)
3744
}
3845
}
39-
40-
// parquetDecoder is a decoder for parquet data.
41-
type parquetDecoder struct {
42-
reader *parquet.BufferedReader
43-
}
44-
45-
// newParquetDecoder creates a new parquet decoder. It uses the libbeat parquet reader under the hood.
46-
// It returns an error if the parquet reader cannot be created.
47-
func newParquetDecoder(config decoderConfig, r io.Reader) (decoder, error) {
48-
reader, err := parquet.NewBufferedReader(r, &parquet.Config{
49-
ProcessParallel: config.Codec.Parquet.ProcessParallel,
50-
BatchSize: config.Codec.Parquet.BatchSize,
51-
})
52-
if err != nil {
53-
return nil, fmt.Errorf("failed to create parquet decoder: %w", err)
54-
}
55-
return &parquetDecoder{
56-
reader: reader,
57-
}, nil
58-
}
59-
60-
// next advances the parquet decoder to the next data item and returns true if there is more data to be decoded.
61-
func (pd *parquetDecoder) next() bool {
62-
return pd.reader.Next()
63-
}
64-
65-
// decode reads and decodes a parquet data stream. After reading the parquet data it decodes
66-
// the output to JSON and returns it as a byte slice. It returns an error if the data cannot be decoded.
67-
func (pd *parquetDecoder) decode() ([]byte, error) {
68-
data, err := pd.reader.Record()
69-
if err != nil {
70-
return nil, err
71-
}
72-
return data, nil
73-
}
74-
75-
// close closes the parquet decoder and releases the resources.
76-
func (pd *parquetDecoder) close() error {
77-
return pd.reader.Close()
78-
}

x-pack/filebeat/input/awss3/decoding_config.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
package awss3
66

7+
import (
8+
"errors"
9+
"fmt"
10+
"unicode/utf8"
11+
)
12+
713
// decoderConfig contains the configuration options for instantiating a decoder.
814
type decoderConfig struct {
915
Codec *codecConfig `config:"codec"`
@@ -12,6 +18,48 @@ type decoderConfig struct {
1218
// codecConfig contains the configuration options for different codecs used by a decoder.
1319
type codecConfig struct {
1420
Parquet *parquetCodecConfig `config:"parquet"`
21+
CSV *csvCodecConfig `config:"csv"`
22+
}
23+
24+
func (c *codecConfig) Validate() error {
25+
if c.Parquet != nil && c.CSV != nil {
26+
return errors.New("more than one decoder configured")
27+
}
28+
return nil
29+
}
30+
31+
// csvCodecConfig contains the configuration options for the CSV codec.
32+
type csvCodecConfig struct {
33+
Enabled bool `config:"enabled"`
34+
35+
// Fields is the set of field names. If it is present
36+
// it is used to specify the object names of returned
37+
// values and the FieldsPerRecord field in the csv.Reader.
38+
// Otherwise, names are obtained from the first
39+
// line of the CSV data.
40+
Fields []string `config:"fields_names"`
41+
42+
// The fields below have the same meaning as the
43+
// fields of the same name in csv.Reader.
44+
Comma *configRune `config:"comma"`
45+
Comment configRune `config:"comment"`
46+
LazyQuotes bool `config:"lazy_quotes"`
47+
TrimLeadingSpace bool `config:"trim_leading_space"`
48+
}
49+
50+
type configRune rune
51+
52+
func (r *configRune) Unpack(s string) error {
53+
if s == "" {
54+
return nil
55+
}
56+
n := utf8.RuneCountInString(s)
57+
if n != 1 {
58+
return fmt.Errorf("single character option given more than one character: %q", s)
59+
}
60+
_r, _ := utf8.DecodeRuneInString(s)
61+
*r = configRune(_r)
62+
return nil
1563
}
1664

1765
// parquetCodecConfig contains the configuration options for the parquet codec.

0 commit comments

Comments
 (0)