Last active
June 20, 2017 08:24
-
-
Save TomonoriSoejima/18561dbecc1534f5a854514297a217ee to your computer and use it in GitHub Desktop.
ingest api with timestamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pattern 1 | |
POST _ingest/pipeline/_simulate | |
{ | |
"pipeline": { | |
"processors": [ | |
{ | |
"kv": { | |
"field": "http_message", | |
"field_split": " ", | |
"value_split": "" | |
} | |
} | |
] | |
}, | |
"docs": [ | |
{ | |
"_source": { | |
"http_message":"04/Jun/2017:06:26:49" | |
} | |
} | |
] | |
} | |
# pattern2 | |
# this fails due to lack of value_split (=) | |
POST _ingest/pipeline/_simulate | |
{ | |
"pipeline": { | |
"processors": [ | |
{ | |
"kv": { | |
"field": "http_message", | |
"field_split": " ", | |
"value_split": "=" | |
} | |
} | |
] | |
}, | |
"docs": [ | |
{ | |
"_source": { | |
"http_message":"04/Jun/2017:06:26:49" | |
} | |
} | |
] | |
} | |
# pattern 3 | |
POST _ingest/pipeline/_simulate | |
{ | |
"pipeline": { | |
"processors": [ | |
{ | |
"kv": { | |
"field": "http_message", | |
"field_split": " ", | |
"value_split": "=" | |
} | |
} | |
] | |
}, | |
"docs": [ | |
{ | |
"_source": { | |
"http_message":"request=\"GET / HTTP/1.0\"" | |
} | |
} | |
] | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST _ingest/pipeline/_simulate | |
{ | |
"pipeline": { | |
"processors": [ | |
{ | |
"grok": { | |
"field": "message", | |
"patterns": [ | |
"request=%{WORD:verb} %{NOTSPACE:request} HTTP/%{NUMBER:httpversion}" | |
] | |
} | |
}, | |
{ | |
"set": { | |
"field": "request", | |
"value": "{{verb}} {{request}} HTTP/{{httpversion}}" | |
} | |
} | |
] | |
}, | |
"docs": [ | |
{ | |
"_source": { | |
"message": "request=GET / HTTP/1.0" | |
} | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST _ingest/pipeline/_simulate | |
{ | |
"pipeline": { | |
"processors": [ | |
{ | |
"kv": { | |
"field": "http_message", | |
"field_split": " ", | |
"value_split": "=" | |
} | |
} | |
] | |
}, | |
"docs": [ | |
{ | |
"_source": { | |
"http_message":"request=\"GET / HTTP/1.0\"" | |
} | |
}, | |
{ | |
"_source": { | |
"http_message":"request=GET" | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment