Advanced filtering in the log explorer #22640
TheOtherBrian1
announced in
Troubleshooting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Querying the Logs
For greater control over the Logs, consider using the Query Explorer.
Basic Queries
Filtering with regex
The Logs use BigQuery Style Regex with the regex_contains function. In its most basic form, it will just check if a string is present in a specified column.
However, there are multiple regex rules that you should consider using:
Find messages that start with a phrase
^only looks for values at the start of a stringFind messages that end with a phrase:
$only looks for values at the end of the stringIgnore case sensitivity:
(?i)ignores capitalization for all proceeding charactersWildcards in regex:
.can represent any string of charactersAlphanumeric ranges in regex:
[1-9a-zA-Z]finds any strings with only numbers and lettersRepeated values in regex:
x*zero or more xx+one or more xx?zero or one xx{4,}four or more xx{3}exactly 3 xEscaping reserved characters:
\.interpreted as period.instead of as a wildcardorstatements in regex:x|yany string withxorypresentand/or/not statements in SQL:
and,or, andnotare all native terms in SQL and can be used in conjunction with regex to filter resultsUnderstanding field references
Each product has its own log table. Unlike traditional tables, log tables contain nested fields. The first and most accessible fields are always the event_message and timestamp. At deeper layers are metadata and beyond:
field reference examples from postgres
The
event_messagecan be accessed immediately.The
metadata.parsed.user_nameandmetadata.parsed.error_severitymust be unnested in a cross-join. This type of querying is used mostly with JSON and array columns, so it may look unfamiliarComplete Example
Filter Postgres errors encountered by the auth server
Limitations
Log tables cannot be joined together
All product tables are independent of each other. They lack connections (like foreign keys) to link them, making table joins impossible. This means merging PostgREST logs with Postgres logs directly wouldn't work.
withandilikestatements cannot be usedThe query editor parses logs for optimization. The parser does not yet support
withand subquery statements. Furthermoreilikeis not supported by BigQuery's variant of SQLBeta Was this translation helpful? Give feedback.
All reactions