gcp getting started with LQL

When working with GCP LQL, we need to work with fields and the log query language itself. To identify what fields that is available we can always check it here.

There are the field that is available for us to query. If you expand that, you can discover more fields.



Next we can also use SEARCH to all a full search (non case sensitive) of all the fields for example. This will retrieve log entry that contains "simple" or "Simple".

SEARCH("Simple")

gcloud logging write my-test-log "A simple entry."
gcloud logging write my-test-log "A simple entry.There are the operator that you can use to refine your query with fields

We can also write to our log using gclod command. 

gcloud logging write my-test-log "A simple entry."


Quick Summary Cheat Sheet

GoalOperator / SyntaxExample
Starts with (abc*)=~ "^abc.*"protoPayload.methodName =~ "^v1.instances.*"
Ends with (*xyz)=~ ".*xyz$"httpRequest.requestUrl =~ ".*\\.png$"
Contains / Substring (*abc*): or =~ ".*abc.*"jsonPayload.message: "timeout"
Exact match=severity = "ERROR"

Comments

Popular posts from this blog

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

llama cpp running it in google colab