71 lines
1.6 KiB
JSON
71 lines
1.6 KiB
JSON
curl -H "Content-Type: application/json" -X PUT http://127.0.0.1:9200/_ingest/pipeline/monitor-cpu -d '
|
|
{
|
|
"description": "monitor-cpu",
|
|
"processors": [
|
|
{
|
|
"grok": {
|
|
"field": "message",
|
|
"patterns": [
|
|
"^%{MONITOR_TIME:monitor.time} %{NUMBER:monitor.cpu.user} %{NUMBER:monitor.cpu.system} %{NUMBER:monitor.cpu.wait} %{NUMBER:monitor.cpu.idle}"
|
|
],
|
|
"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.cpu.user",
|
|
"type": "float"
|
|
}
|
|
},
|
|
{
|
|
"convert": {
|
|
"field": "monitor.cpu.system",
|
|
"type": "float"
|
|
}
|
|
},
|
|
{
|
|
"convert": {
|
|
"field": "monitor.cpu.wait",
|
|
"type": "float"
|
|
}
|
|
},
|
|
{
|
|
"convert": {
|
|
"field": "monitor.cpu.idle",
|
|
"type": "float"
|
|
}
|
|
},
|
|
{
|
|
"remove": {
|
|
"field": "monitor.time"
|
|
}
|
|
},
|
|
{
|
|
"remove": {
|
|
"field": "message"
|
|
}
|
|
}
|
|
]
|
|
}'
|