-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Keep original messages in case of Filebeat modules #8448
Changes from 2 commits
9f2ee77
144c228
016484c
df4304b
d89be27
32eb901
da242a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ package channel | |
import ( | ||
"github.com/elastic/beats/libbeat/beat" | ||
"github.com/elastic/beats/libbeat/common" | ||
"github.com/elastic/beats/libbeat/logp" | ||
"github.com/elastic/beats/libbeat/processors" | ||
) | ||
|
||
|
@@ -43,6 +44,9 @@ type clientEventer struct { | |
// inputOutletConfig defines common input settings | ||
// for the publisher pipeline. | ||
type inputOutletConfig struct { | ||
// KeepOriginalMsg determines if the original message needs to be kept for a module. | ||
KeepOriginalMsg bool `config:"keep_original_message"` | ||
|
||
// event processing | ||
common.EventMetadata `config:",inline"` // Fields and tags to add to events. | ||
Processors processors.PluginConfig `config:"processors"` | ||
|
@@ -59,6 +63,10 @@ type inputOutletConfig struct { | |
|
||
} | ||
|
||
var defaultConfig = inputOutletConfig{ | ||
KeepOriginalMsg: true, | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I strongly believe this should be a opt-in feature. |
||
// NewOutletFactory creates a new outlet factory for | ||
// connecting an input to the publisher pipeline. | ||
func NewOutletFactory( | ||
|
@@ -82,7 +90,7 @@ func NewOutletFactory( | |
// This guarantees ordering between events as required by the registrar for | ||
// file.State updates | ||
func (f *OutletFactory) Create(p beat.Pipeline, cfg *common.Config, dynFields *common.MapStrPointer) (Outleter, error) { | ||
config := inputOutletConfig{} | ||
config := defaultConfig | ||
if err := cfg.Unpack(&config); err != nil { | ||
return nil, err | ||
} | ||
|
@@ -101,13 +109,16 @@ func (f *OutletFactory) Create(p beat.Pipeline, cfg *common.Config, dynFields *c | |
meta := common.MapStr{} | ||
setMeta(meta, "pipeline", config.Pipeline) | ||
|
||
keepOriginal := false | ||
fields := common.MapStr{} | ||
setMeta(fields, "module", config.Module) | ||
setMeta(fields, "name", config.Fileset) | ||
if len(fields) > 0 { | ||
fields = common.MapStr{ | ||
"fileset": fields, | ||
} | ||
keepOriginal = config.KeepOriginalMsg | ||
|
||
} | ||
if config.Type != "" { | ||
fields["prospector"] = common.MapStr{ | ||
|
@@ -119,13 +130,14 @@ func (f *OutletFactory) Create(p beat.Pipeline, cfg *common.Config, dynFields *c | |
} | ||
|
||
client, err := p.ConnectWith(beat.ClientConfig{ | ||
PublishMode: beat.GuaranteedSend, | ||
EventMetadata: config.EventMetadata, | ||
DynamicFields: dynFields, | ||
Meta: meta, | ||
Fields: fields, | ||
Processor: processors, | ||
Events: f.eventer, | ||
PublishMode: beat.GuaranteedSend, | ||
EventMetadata: config.EventMetadata, | ||
DynamicFields: dynFields, | ||
Meta: meta, | ||
Fields: fields, | ||
KeepOriginalMsg: keepOriginal, | ||
Processor: processors, | ||
Events: f.eventer, | ||
}) | ||
if err != nil { | ||
return nil, err | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
# Authorization logs | ||
#auth: | ||
|
@@ -42,6 +45,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
#------------------------------- Apache2 Module ------------------------------ | ||
#- module: apache2 | ||
|
@@ -56,6 +62,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
# Error logs | ||
#error: | ||
|
@@ -68,6 +77,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
#------------------------------- Auditd Module ------------------------------- | ||
#- module: auditd | ||
|
@@ -81,6 +93,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not make statements about doubling the size without measuring it. I also think it's not needed to have this in the config file but we could add a note about it in the docs that the there is increase storage use. |
||
#keep_original_message: true | ||
|
||
#---------------------------- elasticsearch Module --------------------------- | ||
- module: elasticsearch | ||
|
@@ -142,6 +157,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
# Debug logs | ||
#debug: | ||
|
@@ -154,6 +172,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
# Startup logs | ||
#startup: | ||
|
@@ -166,6 +187,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
#--------------------------------- IIS Module -------------------------------- | ||
#- module: iis | ||
|
@@ -180,6 +204,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
# Error logs | ||
#error: | ||
|
@@ -192,6 +219,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
#-------------------------------- Kafka Module ------------------------------- | ||
- module: kafka | ||
|
@@ -250,6 +280,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
#-------------------------------- MySQL Module ------------------------------- | ||
#- module: mysql | ||
|
@@ -264,6 +297,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
# Slow logs | ||
#slowlog: | ||
|
@@ -276,6 +312,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
#-------------------------------- Nginx Module ------------------------------- | ||
#- module: nginx | ||
|
@@ -302,6 +341,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
#------------------------------- Osquery Module ------------------------------ | ||
- module: osquery | ||
|
@@ -330,6 +372,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
#-------------------------------- Redis Module ------------------------------- | ||
#- module: redis | ||
|
@@ -364,6 +409,9 @@ filebeat.modules: | |
# Input configuration (advanced). Any input configuration option | ||
# can be added under this section. | ||
#input: | ||
#Keeps the original message, so the data can be processed again on Ingest Node | ||
#It requires increased storage size, because the sizes of events are approximately doubled. | ||
#keep_original_message: true | ||
|
||
|
||
#=========================== Filebeat inputs ============================= | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not put it under breaking change as it's and addition but we should definitively have a note in the migration guide about the additional storage use.