TTimo
TTimo

Reputation: 1396

How to exclude a pattern when viewing app engine logs in the cloud console?

I would like to exclude a string, or more generally a pattern from the app engine logs when I am auditing them in the app engine console.

I have tried the 'negative look ahead' solution described in Regular expression to match a line that doesn't contain a word? without success. Can someone post a working example?

Upvotes: 6

Views: 11482

Answers (3)

Jim Jimson
Jim Jimson

Reputation: 2528

This is now possible using the below:

=~          # regular expression search for a pattern

!~          # regular expression search not for a pattern

You can find more details here.

Currently I have enabled slow_query_log in MySql and I'm using the below to exclude some of the values stored in the log:

-textPayload=~"SET timestamp="
-textPayload=~"# User@Host: root[root] @  [127.0.0.1]"

Here's an example of each of the textPayloads:

SET timestamp=1607853094;
# User@Host: root[root] @  [127.0.0.1]  thread_id:  3735  server_id: 14545446173

Upvotes: 5

Code Commander
Code Commander

Reputation: 17290

It appears this is now possible using the Advanced Search and combining operators with the NOT keyword. The simplest example is to use NOT before the text search expression:

resource.type="vpn_gateway"
"sending packet"
NOT "to 127.0.0.123"

This will search for vpn_gateway log entries containing the text "sending packet" and not containing the text "to 127.0.0.123"

More details is available in the Advanced Logs Filters Documentation.

Upvotes: 6

Eric Jay
Eric Jay

Reputation: 36

It is currently not possible to do a negative search using logs viewer in the Google Developer Console. However there is a workaround exporting logs to Google BigQuery, there you can run these regular expressions on Request logs (and not app logs).

Upvotes: 0

Related Questions