Skip to content

Commit e119f81

Browse files
authored
Merge branch 'main' into dependabot/go_modules/main/windows-67a2ff958b
2 parents e5dd115 + b5c5158 commit e119f81

File tree

30 files changed

+432
-223
lines changed

30 files changed

+432
-223
lines changed

NOTICE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10879,11 +10879,11 @@ SOFTWARE
1087910879

1088010880
--------------------------------------------------------------------------------
1088110881
Dependency : github.com/elastic/elastic-agent-libs
10882-
Version: v0.24.0
10882+
Version: v0.24.1
1088310883
Licence type (autodetected): Apache-2.0
1088410884
--------------------------------------------------------------------------------
1088510885

10886-
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].0/LICENSE:
10886+
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].1/LICENSE:
1088710887

1088810888
Apache License
1088910889
Version 2.0, January 2004

auditbeat/module/auditd/audit_linux.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ package auditd
2020
import (
2121
"errors"
2222
"fmt"
23+
"maps"
2324
"os"
2425
"runtime"
26+
"slices"
2527
"strconv"
2628
"strings"
2729
"sync"
2830
"syscall"
2931
"time"
3032

3133
"github.com/elastic/beats/v7/auditbeat/ab"
32-
"github.com/elastic/beats/v7/libbeat/common"
3334
"github.com/elastic/beats/v7/metricbeat/mb"
3435
"github.com/elastic/beats/v7/metricbeat/mb/parse"
3536
"github.com/elastic/elastic-agent-libs/logp"
@@ -629,13 +630,13 @@ func buildMetricbeatEvent(msgs []*auparse.AuditMessage, config Config) mb.Event
629630
normalizeEventFields(auditEvent, out.RootFields)
630631

631632
// User set for related.user
632-
var userSet common.StringSet
633+
var userSet map[string]struct{}
633634
if config.ResolveIDs {
634-
userSet = make(common.StringSet)
635+
userSet = make(map[string]struct{})
635636
}
636637

637638
// Copy user.*/group.* fields from event
638-
setECSEntity := func(key string, ent aucoalesce.ECSEntityData, root mapstr.M, set common.StringSet) {
639+
setECSEntity := func(key string, ent aucoalesce.ECSEntityData, root mapstr.M, set map[string]struct{}) {
639640
if ent.ID == "" && ent.Name == "" {
640641
return
641642
}
@@ -652,7 +653,7 @@ func buildMetricbeatEvent(msgs []*auparse.AuditMessage, config Config) mb.Event
652653
if ent.Name != "" {
653654
_, _ = root.Put(nameField, ent.Name)
654655
if set != nil {
655-
set.Add(ent.Name)
656+
set[ent.Name] = struct{}{}
656657
}
657658
} else {
658659
_ = root.Delete(nameField)
@@ -665,10 +666,9 @@ func buildMetricbeatEvent(msgs []*auparse.AuditMessage, config Config) mb.Event
665666
setECSEntity("user.changes", auditEvent.ECS.User.Changes, out.RootFields, userSet)
666667
setECSEntity("group", auditEvent.ECS.Group, out.RootFields, nil)
667668

668-
if userSet != nil {
669-
if userSet.Count() != 0 {
670-
_, _ = out.RootFields.Put("related.user", userSet.ToSlice())
671-
}
669+
if len(userSet) != 0 {
670+
relatedUser := slices.Compact(slices.Sorted(maps.Keys(userSet)))
671+
_, _ = out.RootFields.Put("related.user", relatedUser)
672672
}
673673
getStringField := func(key string, m mapstr.M) (str string) {
674674
if asIf, _ := m.GetValue(key); asIf != nil {

auditbeat/module/file_integrity/action.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ package file_integrity
1919

2020
import (
2121
"math/bits"
22+
"slices"
2223
"strings"
23-
24-
"github.com/elastic/beats/v7/libbeat/common"
2524
)
2625

2726
// Action is a description of the changes described by an event.
@@ -128,7 +127,9 @@ func (action Action) ECSTypes() []string {
128127
list = append(list, name)
129128
}
130129
}
131-
return common.MakeStringSet(list...).ToSlice()
130+
slices.Sort(list)
131+
list = slices.Compact(list)
132+
return list
132133
}
133134

134135
// MarshalText marshals the Action to a textual representation of itself.
@@ -211,5 +212,7 @@ func (actions ActionArray) ECSTypes() []string {
211212
for _, action := range actions {
212213
list = append(list, action.ECSTypes()...)
213214
}
214-
return common.MakeStringSet(list...).ToSlice()
215+
slices.Sort(list)
216+
list = slices.Compact(list)
217+
return list
215218
}

auditbeat/scripts/docs_collector.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ def collect(base_paths):
5050
versions.append(f"{key} {value}")
5151
applies_to = ", ".join(versions)
5252
elif "release" in fields[0]:
53-
if fields[0]["release"] != "ga":
54-
applies_to = fields[0]["release"]
53+
applies_to = fields[0]["release"]
54+
else:
55+
applies_to = "ga"
5556

5657
module_file = """---
5758
mapped_pages:
@@ -167,6 +168,8 @@ def collect(base_paths):
167168
module_list_output = """---
168169
mapped_pages:
169170
- https://www.elastic.co/guide/en/beats/auditbeat/current/auditbeat-modules.html
171+
applies_to:
172+
stack: ga
170173
---
171174
172175
% This file is generated! See scripts/docs_collector.py
@@ -181,7 +184,7 @@ def collect(base_paths):
181184
title = details["title"]
182185
applies_to = details["applies_to"]
183186
module_list_output += "* [{}](/reference/auditbeat/auditbeat-module-{}.md)".format(title, m)
184-
if applies_to:
187+
if applies_to and applies_to is not "ga":
185188
module_list_output += " {{applies_to}}`stack: {}`".format(applies_to)
186189
module_list_output += "\n"
187190

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kind: bug-fix
2+
summary: fix defer usage for stopped status reporting
3+
component: filebeat
4+
5+
# AUTOMATED
6+
# OPTIONAL to manually add other PR URLs
7+
# PR URL: A link the PR that added the changeset.
8+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
9+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
10+
# Please provide it if you are adding a fragment for a different PR.
11+
# pr: https://github.com/owner/repo/1234
12+
13+
# AUTOMATED
14+
# OPTIONAL to manually add other issue URLs
15+
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
16+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
17+
# issue: https://github.com/owner/repo/1234

docs/reference/auditbeat/auditbeat-module-auditd.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
mapped_pages:
33
- https://www.elastic.co/guide/en/beats/auditbeat/current/auditbeat-module-auditd.html
4+
applies_to:
5+
stack: ga
46
---
57

68
% This file is generated! See scripts/docs_collector.py

docs/reference/auditbeat/auditbeat-module-file_integrity.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
mapped_pages:
33
- https://www.elastic.co/guide/en/beats/auditbeat/current/auditbeat-module-file_integrity.html
4+
applies_to:
5+
stack: ga
46
---
57

68
% This file is generated! See scripts/docs_collector.py

docs/reference/auditbeat/auditbeat-modules.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
mapped_pages:
33
- https://www.elastic.co/guide/en/beats/auditbeat/current/auditbeat-modules.html
4+
applies_to:
5+
stack: ga
46
---
57

68
% This file is generated! See scripts/docs_collector.py

docs/reference/auditbeat/kafka-output.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,21 @@ To use `GSSAPI` mechanism to authenticate with Kerberos, you must leave this fie
9999

100100
The Kafka topic used for produced events.
101101

102-
You can set the topic dynamically by using a format string to access any event field. For example, this configuration uses a custom field, `fields.log_topic`, to set the topic for each event:
102+
You can set a static topic, for example `auditbeat`, or you can use a format string to set a topic dynamically based on one or more [Elastic Common Schema (ECS)](ecs://reference/index.md) fields. Available fields include:
103+
104+
* `data_stream.type`
105+
* `data_stream.dataset`
106+
* `data_stream.namespace`
107+
* `@timestamp`
108+
* `event.dataset`
109+
110+
For example:
111+
112+
```yaml
113+
topic: '%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}'
114+
```
115+
116+
You can also set a custom field. This is useful if you need to construct a more complex or structured topic name. For example, this configuration uses the `fields.log_topic` custom field to set the topic for each event:
103117

104118
```yaml
105119
topic: '%{[fields.log_topic]}'
@@ -109,6 +123,19 @@ topic: '%{[fields.log_topic]}'
109123
To learn how to add custom fields to events, see the [`fields`](/reference/auditbeat/configuration-general-options.md#libbeat-configuration-fields) option.
110124
::::
111125

126+
To set a dynamic topic value for outputting {{auditbeat}} data to Kafka, you can add the [`add_fields` processor](/reference/auditbeat/add-fields.md) to {{auditbeat}}'s input configuration settings.
127+
128+
For example, the following `add_fields` processor creates a dynamic topic value for the `fields.log_topic` field by combining multiple [ECS data stream fields](ecs://reference/ecs-data_stream.md):
129+
130+
```yaml
131+
- add_fields:
132+
target: ''
133+
fields:
134+
log_topic: '%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}' <1>
135+
```
136+
1. Depending on the values of the data stream fields, this generates topic names such as `logs-nginx.access-production` or `metrics-system.cpu-staging` as the value of the custom `log_topic` field.
137+
138+
For more information, refer to [Filter and enhance data with processors](/reference/auditbeat/filtering-enhancing-data.md).
112139

113140
See the [`topics`](#topics-option-kafka) setting for other ways to set the topic dynamically.
114141

docs/reference/filebeat/kafka-output.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,21 @@ To use `GSSAPI` mechanism to authenticate with Kerberos, you must leave this fie
9999

100100
The Kafka topic used for produced events.
101101

102-
You can set the topic dynamically by using a format string to access any event field. For example, this configuration uses a custom field, `fields.log_topic`, to set the topic for each event:
102+
You can set a static topic, for example `filebeat`, or you can use a format string to set a topic dynamically based on one or more [Elastic Common Schema (ECS)](ecs://reference/index.md) fields. Available fields include:
103+
104+
* `data_stream.type`
105+
* `data_stream.dataset`
106+
* `data_stream.namespace`
107+
* `@timestamp`
108+
* `event.dataset`
109+
110+
For example:
111+
112+
```yaml
113+
topic: '%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}'
114+
```
115+
116+
You can also set a custom field. This is useful if you need to construct a more complex or structured topic name. For example, this configuration uses the `fields.log_topic` custom field to set the topic for each event:
103117

104118
```yaml
105119
topic: '%{[fields.log_topic]}'
@@ -109,6 +123,19 @@ topic: '%{[fields.log_topic]}'
109123
To learn how to add custom fields to events, see the [`fields`](/reference/filebeat/configuration-general-options.md#libbeat-configuration-fields) option.
110124
::::
111125

126+
To set a dynamic topic value for outputting {{filebeat}} data to Kafka, you can add the [`add_fields` processor](/reference/filebeat/add-fields.md) to {{filebeat}}'s input configuration settings.
127+
128+
For example, the following `add_fields` processor creates a dynamic topic value for the `fields.log_topic` field by combining multiple [ECS data stream fields](ecs://reference/ecs-data_stream.md):
129+
130+
```yaml
131+
- add_fields:
132+
target: ''
133+
fields:
134+
log_topic: '%{[data_stream.type]}-%{[data_stream.dataset]}-%{[data_stream.namespace]}' <1>
135+
```
136+
1. Depending on the values of the data stream fields, this generates topic names such as `logs-nginx.access-production` or `metrics-system.cpu-staging` as the value of the custom `log_topic` field.
137+
138+
For more information, refer to [Filter and enhance data with processors](/reference/filebeat/filtering-enhancing-data.md).
112139

113140
See the [`topics`](#topics-option-kafka) setting for other ways to set the topic dynamically.
114141

0 commit comments

Comments
 (0)