GCP logger filter missing fields

428 Views Asked by At

My application runs in NodeJS in GCP Cloud Run, it uses the REST API and logs the request object. I'm trying to filter out results with missing field locationId in jsonPayload.req.body.destination object in GCP logger.

I tried this filter:

NOT jsonPayload.req.body.destination:locationId

or

NOT jsonPayload.req.body.destination=locationId

but it doesn't work.

I'm looking for some results like this:

destination: {
addressLine1: "my address"
contactEmail: "[email protected]"
postalCode: "74757"
}

you can see the locationId is missing there

1

There are 1 best solutions below

0
On BEST ANSWER

Maybe I found a solution, this should work for my case:

-jsonPayload.req.body.destination.locationId:*
jsonPayload.req.body.destination:*