node.jshttpgoogle-cloud-platformgoogle-logging

GCP logger filter missing fields


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: "john@doe.com"
postalCode: "74757"
}

you can see the locationId is missing there


Solution

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

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