Skip to content

Commit cfcb4f1

Browse files
committed
Remove document_id and make docs more clear
1 parent 50209e1 commit cfcb4f1

4 files changed

Lines changed: 3 additions & 22 deletions

File tree

CHANGELOG.next.asciidoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,6 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
616616
- Libbeat: report queue capacity, output batch size, and output client count to monitoring. {pull}24700[24700]
617617
- Add kubernetes.pod.ip field in kubernetes metadata. {pull}25037[25037]
618618
- Discover changes in Kubernetes namespace metadata as soon as they happen. {pull}25117[25117]
619-
- Add `decode_xml_wineventlog` processor. {issue}23910[23910] {pull}25109[25109]
620619
- Add `decode_xml_wineventlog` processor. {issue}23910[23910] {pull}25115[25115]
621620

622621
*Auditbeat*

libbeat/processors/decode_xml_wineventlog/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ type config struct {
2222
Target string `config:"target_field"`
2323
OverwriteKeys bool `config:"overwrite_keys"`
2424
MapECSFields bool `config:"map_ecs_fields"`
25-
DocumentID string `config:"document_id"`
2625
IgnoreMissing bool `config:"ignore_missing"`
2726
IgnoreFailure bool `config:"ignore_failure"`
2827
}

libbeat/processors/decode_xml_wineventlog/docs/decode_xml_wineventlog.asciidoc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ exist in the event are overwritten by keys from the decoded XML object. The
2727
default value is `true`.
2828

2929
`map_ecs_fields`:: (Optional) A boolean that specifies whether to map additional ECS
30-
fields when possible. The default value is `true`.
31-
32-
`document_id`:: (Optional) XML key to use as the document ID. If configured, the
33-
field will be removed from the original XML document and stored in
34-
`@metadata._id`.
30+
fields when possible. Note that ECS field keys are placed outside of `target_field`. The default value is `true`.
3531

3632
`ignore_missing`:: (Optional) If `true` the processor will not return an error
3733
when a specified field does not exist. Defaults to `false`.

libbeat/processors/decode_xml_wineventlog/processor.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ func init() {
4848
checks.RequireFields("field", "target_field"),
4949
checks.AllowedFields(
5050
"field", "target_field",
51-
"overwrite_keys", "document_id",
51+
"overwrite_keys", "map_ecs_fields",
5252
"ignore_missing", "ignore_failure",
53-
"map_ecs_fields",
5453
)))
5554
jsprocessor.RegisterPlugin(procName, New)
5655
}
@@ -89,7 +88,7 @@ func newProcessor(config config) (processors.Processor, error) {
8988

9089
func (p *processor) Run(event *beat.Event) (*beat.Event, error) {
9190
if err := p.run(event); err != nil && !p.IgnoreFailure {
92-
err = fmt.Errorf("failed in decode_xml on the %q field: %w", p.Field, err)
91+
err = fmt.Errorf("failed in decode_xml_wineventlog on the %q field: %w", p.Field, err)
9392
event.PutValue("error.message", err.Error())
9493
return event, err
9594
}
@@ -115,14 +114,6 @@ func (p *processor) run(event *beat.Event) error {
115114
return fmt.Errorf("error decoding XML field: %w", err)
116115
}
117116

118-
var id string
119-
if tmp, err := common.MapStr(win).GetValue(p.DocumentID); err == nil {
120-
if v, ok := tmp.(string); ok {
121-
id = v
122-
common.MapStr(win).Delete(p.DocumentID)
123-
}
124-
}
125-
126117
if p.Target != "" {
127118
if _, err = event.PutValue(p.Target, win); err != nil {
128119
return fmt.Errorf("failed to put value %v into field %q: %w", win, p.Target, err)
@@ -135,10 +126,6 @@ func (p *processor) run(event *beat.Event) error {
135126
jsontransform.WriteJSONKeys(event, ecs, false, p.OverwriteKeys, !p.IgnoreFailure)
136127
}
137128

138-
if id != "" {
139-
event.SetID(id)
140-
}
141-
142129
return nil
143130
}
144131

0 commit comments

Comments
 (0)