I have logs like this:
I, [2020-06-17T09:32:48.100103 #9] INFO -- : [54b35e04-9c19-443d-adff-b2c3192b5590] Completed 500 Internal Server Error in 7ms (ActiveRecord: 2.3ms | Allocations: 1705)
I, [2020-06-17T10:37:27.169909 #9] INFO -- : [c800e9ce-fba3-4e1a-a19f-526f32746925] Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms | Allocations: 115)
So as you can see in message it is always fallowing the pattern: Completed [THE ERROR CODE] [ERROR MESSAGE] ...
I'm using this query to retrieve logs with certain error codes:
fields @timestamp, @message
| filter @message like /401/
| sort @timestamp desc
| limit 20
But how can I parse the message to get separate fields for error code and message?