Skip to content

Commit 04da63b

Browse files
authored
Fix move plugin (#737)
* Fix move plugin * Fix move plugin doc
1 parent de8f0fc commit 04da63b

File tree

6 files changed

+169
-205
lines changed

6 files changed

+169
-205
lines changed

plugin/README.md

Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -456,95 +456,8 @@ The resulting event could look like:
456456
[More details...](plugin/action/modify/README.md)
457457
## move
458458
It moves fields to the target field in a certain mode.
459-
> In `allow` mode, the specified `fields` will be moved;
460-
> in `block` mode, the unspecified `fields` will be moved.
461-
462-
### Examples
463-
```yaml
464-
pipelines:
465-
example_pipeline:
466-
...
467-
actions:
468-
- type: move
469-
mode: allow
470-
target: other
471-
fields:
472-
- log.stream
473-
- zone
474-
...
475-
```
476-
The original event:
477-
```json
478-
{
479-
"service": "test",
480-
"log": {
481-
"level": "error",
482-
"message": "error occurred",
483-
"ts": "2023-10-30T13:35:33.638720813Z",
484-
"stream": "stderr"
485-
},
486-
"zone": "z501"
487-
}
488-
```
489-
The resulting event:
490-
```json
491-
{
492-
"service": "test",
493-
"log": {
494-
"level": "error",
495-
"message": "error occurred",
496-
"ts": "2023-10-30T13:35:33.638720813Z"
497-
},
498-
"other": {
499-
"stream": "stderr",
500-
"zone": "z501"
501-
}
502-
}
503-
```
504-
---
505-
```yaml
506-
pipelines:
507-
example_pipeline:
508-
...
509-
actions:
510-
- type: move
511-
mode: block
512-
target: other
513-
fields:
514-
- log
515-
...
516-
```
517-
The original event:
518-
```json
519-
{
520-
"service": "test",
521-
"log": {
522-
"level": "error",
523-
"message": "error occurred",
524-
"ts": "2023-10-30T13:35:33.638720813Z",
525-
"stream": "stderr"
526-
},
527-
"zone": "z501",
528-
"other": {
529-
"user": "ivanivanov"
530-
}
531-
}
532-
```
533-
The resulting event:
534-
```json
535-
{
536-
"log": {
537-
"level": "error",
538-
"message": "error occurred",
539-
"ts": "2023-10-30T13:35:33.638720813Z"
540-
},
541-
"other": {
542-
"user": "ivanivanov",
543-
"service": "test",
544-
"zone": "z501"
545-
}
546-
}
547-
```
459+
* In `allow` mode, the specified `fields` will be moved
460+
* In `block` mode, the unspecified `fields` will be moved
548461

549462
[More details...](plugin/action/move/README.md)
550463
## parse_es

plugin/action/README.md

Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -299,95 +299,8 @@ The resulting event could look like:
299299
[More details...](plugin/action/modify/README.md)
300300
## move
301301
It moves fields to the target field in a certain mode.
302-
> In `allow` mode, the specified `fields` will be moved;
303-
> in `block` mode, the unspecified `fields` will be moved.
304-
305-
### Examples
306-
```yaml
307-
pipelines:
308-
example_pipeline:
309-
...
310-
actions:
311-
- type: move
312-
mode: allow
313-
target: other
314-
fields:
315-
- log.stream
316-
- zone
317-
...
318-
```
319-
The original event:
320-
```json
321-
{
322-
"service": "test",
323-
"log": {
324-
"level": "error",
325-
"message": "error occurred",
326-
"ts": "2023-10-30T13:35:33.638720813Z",
327-
"stream": "stderr"
328-
},
329-
"zone": "z501"
330-
}
331-
```
332-
The resulting event:
333-
```json
334-
{
335-
"service": "test",
336-
"log": {
337-
"level": "error",
338-
"message": "error occurred",
339-
"ts": "2023-10-30T13:35:33.638720813Z"
340-
},
341-
"other": {
342-
"stream": "stderr",
343-
"zone": "z501"
344-
}
345-
}
346-
```
347-
---
348-
```yaml
349-
pipelines:
350-
example_pipeline:
351-
...
352-
actions:
353-
- type: move
354-
mode: block
355-
target: other
356-
fields:
357-
- log
358-
...
359-
```
360-
The original event:
361-
```json
362-
{
363-
"service": "test",
364-
"log": {
365-
"level": "error",
366-
"message": "error occurred",
367-
"ts": "2023-10-30T13:35:33.638720813Z",
368-
"stream": "stderr"
369-
},
370-
"zone": "z501",
371-
"other": {
372-
"user": "ivanivanov"
373-
}
374-
}
375-
```
376-
The resulting event:
377-
```json
378-
{
379-
"log": {
380-
"level": "error",
381-
"message": "error occurred",
382-
"ts": "2023-10-30T13:35:33.638720813Z"
383-
},
384-
"other": {
385-
"user": "ivanivanov",
386-
"service": "test",
387-
"zone": "z501"
388-
}
389-
}
390-
```
302+
* In `allow` mode, the specified `fields` will be moved
303+
* In `block` mode, the unspecified `fields` will be moved
391304

392305
[More details...](plugin/action/move/README.md)
393306
## parse_es

plugin/action/move/README.idoc.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Move plugin
22
@introduction
33

4-
### Config params
4+
## Examples
5+
@examples
6+
7+
## Config params
58
@config-params|description

plugin/action/move/README.md

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Move plugin
22
It moves fields to the target field in a certain mode.
3-
> In `allow` mode, the specified `fields` will be moved;
4-
> in `block` mode, the unspecified `fields` will be moved.
3+
* In `allow` mode, the specified `fields` will be moved
4+
* In `block` mode, the unspecified `fields` will be moved
55

6-
### Examples
6+
## Examples
77
```yaml
88
pipelines:
99
example_pipeline:
@@ -89,12 +89,60 @@ The resulting event:
8989
}
9090
}
9191
```
92+
---
93+
```yaml
94+
pipelines:
95+
example_pipeline:
96+
...
97+
actions:
98+
- type: move
99+
mode: allow
100+
target: other
101+
fields:
102+
- log.message
103+
- error.message
104+
- zone
105+
...
106+
```
107+
The original event:
108+
```json
109+
{
110+
"service": "test",
111+
"log": {
112+
"message": "some log",
113+
"ts": "2023-10-30T13:35:33.638720813Z"
114+
},
115+
"error": {
116+
"code": 1,
117+
"message": "error occurred"
118+
},
119+
"zone": "z501"
120+
}
121+
```
122+
The resulting event:
123+
```json
124+
{
125+
"service": "test",
126+
"log": {
127+
"ts": "2023-10-30T13:35:33.638720813Z"
128+
},
129+
"error": {
130+
"code": 1,
131+
},
132+
"other": {
133+
"message": "error occurred",
134+
"zone": "z501"
135+
}
136+
}
137+
```
92138

93-
### Config params
139+
## Config params
94140
**`fields`** *`[]cfg.FieldSelector`* *`required`*
95141

96142
The list of the fields to move.
97-
> In `block` mode, the maximum `fields` depth is 1.
143+
> 1. In `block` mode, the maximum `fields` depth is 1.
144+
> 2. If several fields have the same end of the path,
145+
> the last specified field will overwrite the previous ones.
98146
99147
<br>
100148

@@ -107,9 +155,9 @@ The mode of the moving. Available modes are one of: `allow|block`.
107155
**`target`** *`cfg.FieldSelector`* *`required`*
108156

109157
The target field of the moving.
110-
> If the `target` field is existing non-object field, it will be overwritten as object field.
111-
112-
> In `block` mode, the maximum `target` depth is 1.
158+
> 1. In `block` mode, the maximum `target` depth is 1.
159+
> 2. If the `target` field is existing non-object field,
160+
> it will be overwritten as object field.
113161
114162
<br>
115163

0 commit comments

Comments
 (0)