Sitescope regular expression

661 views Asked by At

I will like to create an alert if an event has “httpStatus” : 400 and “errorCode” : “40000”.

Can someone help with a regular expression? The log looks something like this:

“UserMessage” : “Bad Request”,
“DeveloperMessage” : xxxxxxxxxxxxxxxxxcxxx
“HttpStatus” : 400,
“ErrorCode” : “40000”,
“GatewayErrors : “xxxx”
Xxxxxx
Xxxxxx

I tried string search /“HtHttpStatus” : 400, “ErrorCode” : “40000” and /[“HttpStatus” : 400], [“ErrorCode” : “40000” ]a

1

There are 1 answers

0
Matt.G On

try Regex: /“HttpStatus” : 400,.*“ErrorCode” : “40000”/s

Demo

As mentioned in this link, /s considers the content as being on a single line, ignoring intervening carriage returns and new line characters. With this modifier both the Consider the content as being on a single line, ignoring intervening carriage returns and new line characters. With this modifier both the [\w\W]* character class and the .* pattern will match across new lines and carriage returns. character class and the .* pattern will match across new lines and carriage returns.