Reputation: 785
I am trying to filter logs based on resource mapping using "protoPayload.resource" property. It works fine if I specify the exact resource name.
metadata.serviceName="appengine.googleapis.com"
metadata.labels."appengine.googleapis.com/module_id"={module}
metadata.labels."appengine.googleapis.com/version_id"={version}
log="appengine.googleapis.com/request_log"
protoPayload.resource = ***********
How to supply a regex for this property to filter out logs?
Maven dependency for logging api:
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-logging</artifactId>
<version>v2beta1-rev9-1.21.0</version>
</dependency>
Upvotes: 3
Views: 2162
Reputation: 1905
The advanced queries documentation page lists the regex operator =~ Further, there is a dedicated documentation page specifically for the regular expression use in the new log viewer. As of 2020-09-13, this page is marked as "new"
Upvotes: 0
Reputation: 314
The Stackdriver Logging API does not currently support regular expressions.
It does, however, support a "has" operator through using a :
instead of an =
in your filter expression, e.g. path.to.field: "value"
. This matches substrings of the actual value in a case-insensitive fashion, which is most of what people typically used it for anyway.
See also: Write effective advanced filters
If the "has" operator doesn't accomplish your goal, consider filing feedback through the speech bubble button in the top right of the Cloud Console providing details of your use case and what you're ultimately trying to accomplish, and we'll incorporate that feedback as we plan the future direction of the product.
Upvotes: 2