efk/pipelines/monitor-ping.json
2021-08-29 00:02:22 +08:00

53 lines
1.3 KiB
JSON

curl -H "Content-Type: application/json" -X PUT http://127.0.0.1:9200/_ingest/pipeline/monitor-ping -d '
{
"description": "monitor-ping",
"processors": [
{
"grok": {
"field": "message",
"patterns": [
"^%{MONITOR_TIME:monitor.time} %{HOSTNAME:monitor.ping.server} %{DATA:monitor.ping.state} %{NUMBER:monitor.ping.state_code}"
],
"pattern_definitions" : {
"MONITOR_TIME" : "^20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]"
},
"ignore_missing" : true,
"ignore_failure" : true
}
},
{
"rename" : {
"field" : "@timestamp",
"target_field" : "read_timestamp"
}
},
{
"date" : {
"formats" : [
"YYYY-MM-dd H:m:s"
],
"timezone" : "Asia/Shanghai",
"field" : "monitor.time",
"target_field" : "@timestamp",
"ignore_failure" : true
}
},
{
"convert": {
"field": "monitor.ping.state_code",
"type": "integer"
}
},
{
"remove": {
"field": "monitor.time"
}
},
{
"remove": {
"field": "message"
}
}
]
}'