Consider an access log of a REST API, you will see lines (simplified) that looks like this:
2017-01-01T12:12:41Z "GET /api/posts" HTTP/1.1 200 "-"
2017-01-01T12:12:42Z "GET /api/posts/56/comments" HTTP/1.1 200 "-"
2017-01-01T12:12:42Z "GET /api/posts" HTTP/1.1 200 "-"
2017-01-01T12:12:56Z "POST /api/posts" HTTP/1.1 202 "Safari"
2017-01-01T12:12:58Z "GET /api/posts/134/comments" HTTP/1.1 200 "-"
To parse that you could write something like :
_collector=access.log | regex parse "(?<method>[A-Z]+) /api/(?<path>[\w\d\/]+) HTTP"
This would extract METHOD and PATH form the log lines, BUT you would see these unique values:
- GET posts
- POST posts
- GET posts/56/comments
- GET posts/134/comments
I wish to throw away all the dynamic parts of the url, so I could find the following instead:
- GET posts
- POST posts
- GET posts/{id}/comments
I could figure out this in a search and replace regex easily enough, but is it even possible in Sumologic?