Some basic search help

I’m looking to filter the logs messages going into pick out the
location, store, operator and nonce.

Nov 15 20:16:25 PROD SERVER: [ERROR]
c.q.s.w.c.mycompanyControllerAdvice:
logTraceId=f498cef6516543e1a70dc9bad5f7358a, order=36276,
nonce=CC41B399-6664-4E88-8A17-1DD30327175C, location=20655,
restaurant=294, operator=42
com.mycompany.server.exceptions.pos.mcp.McpException

Can anyone help? Happy to focus on location first.

^ I need something in here I think (location=)\d

Given a string such as the one you have posted, you can get the location
by applying the regexp

/ location=(\d+)/

but in any case, there are several possible solutions. For example, are
alsways all these fields supplied, in exactly the same sequence? Would
it preferable (more flexible) to have all NAME=VALUE pairs extracted
from the string?

Hi Ronald,

Thanks for this. I need each NAME=VALUE extracted but not all together
in the one expression. I need each separately.

Taking your example above, how would I only select the numbers after the
‘location=’?

String#scan is your friend.

Assuming that the whole line is stored in variable whole_line, the
expression

whole_line.scan((\w+)=(\w+))

returns an array of pairs, where the first element of each pair is the
NAME, and the second element is the value.