processor_fields_with_condition
配置
enable: true
inputs:
- Type: metric_mock
Fields:
content : "{\"t1\": \"2022-07-22 12:50:08.571218122\", \"t2\": \"2022-07-22 12:50:08\", \"a\":\"b\",\"c\":2,\"d\":10, \"seq\": 20}"
t1 : "2022-07-22 12:50:08.571218122"
t2 : "2022-07-22 12:50:08"
a : b
c : "2"
d : "10"
seq : "20"
processors:
- Type: processor_fields_with_condition
DropIfNotMatchCondition: true
Switch:
- Case:
FieldConditions:
seq: "10"
d: "10"
Actions:
- type: processor_add_fields
IgnoreIfExist: false
Fields:
eventCode: event_00001
name: error_oom
- type: processor_drop
DropKeys:
- c
- Case:
FieldConditions:
seq: "20"
d: "10"
Actions:
- type: processor_add_fields
IgnoreIfExist: false
Fields:
eventCode: event_00002
name: error_oom2
flushers:
- Type: flusher_stdout
OnlyStdout: true
{
"Index":"1",
"a":"b",
"c":"2",
"content":"{\"t1\": \"2022-07-22 12:50:08.571218122\", \"t2\": \"2022-07-22 12:50:08\", \"a\":\"b\",\"c\":2,\"d\":10, \"seq\": 20}",
"d":"10",
"seq":"20",
"t1":"2022-07-22 12:50:08.571218122",
"t2":"2022-07-22 12:50:08",
"eventCode":"event_00002",
"name":"error_oom2",
"__time__":"1658490721"
}