Filter logs in Google Cloud by when fields exist that match a pattern

Viewed 739

We're using Google's security scanning and it makes queries with unique parameters on each scan. This causes new jsonPayload sub-fields to show up in our logs:

jsonPayload.params.utf8javascript_xssdetected_22312223341220000094915n_____javascript_javascript_______________noscript___title___textarea___style_

We sink these logs into BigQuery and because these are high-cardinality it causes the BigQuery table to run out of columns. I'd like to just drop all of these entries but I can't figure out the Google Cloud Logging query syntax to match fields on a pattern.

For example, I'd love to be able to exclude any lines where fields matching the following patterns exist (regex in the square brackets):

-jsonPayload.params.[.*xssdetected.*]:*
-jsonPayload.params.[.*metadata_google_internal.*]:*
-jsonPayload.params.[.*randmprmz.*]:*

Any idea if this is possible?

0 Answers
Related