Professional tip: you possibly can paste a timestamp just like the one under straight into the sector for customized time.
Put highly-queried information into indexed fields. You should use the Cloud Logging agent to route log data to indexed fields for improved efficiency, for instance. Putting listed information within the “labels” LogEntry subject will typically yield sooner look-ups.
Prohibit your queries to a particular subject. If that the information you’re searching for is in a particular subject, restrict the query to that subject fairly than utilizing the much less environment friendly global restriction.
textPayload =~ "CONNECTING"
Are you able to inform us extra about utilizing common expressions in Cloud Logging?
Our filter language is superb at discovering textual content, or values expressed as textual content, in some instances to the purpose of oversimplification on the expense of specificity. Previous to common expressions, should you wished to seek for any form of sample complexity, you needed to construct a similitude of that complexity out of conjunctive and disjunctive phrases, usually resulting in over-querying log entries and underperforming queries.
Now, with assist for normal expressions, you possibly can carry out a case-sensitive search, match complicated patterns, and even substring seek for a single “*” character.
The RE2 syntax we use for normal expressions is a well-recognized, well-documented, and performant common expression language. Providing it to customers as a question possibility permits customers to naturally and performantly categorical precisely the log information that they’re looking for.
For instance, beforehand should you wished to seek for a textual content payload starting with “Consumer” and ending with both “Logged In” or “Logged Out”, you would need to use a substring expression like:
(textPayload:Consumer AND (textPayload:"Logged In" OR textPayload:"Logged Out"))
One thing like this deviates considerably from the precise meant question:
There is no such thing as a ordering in substring matching, so “I’ve Logged In a Consumer” would match the filter’s constraints.
Every time period executes independently, so this executes as much as three matches per candidate log entry internally, costing extra matching time.
Substring matches are case-insensitive. There is no such thing as a solution to exclude e.g., “logged in”.
However with a daily expression, you possibly can execute:
textPayload =~ "^Consumer.*Logged (In|Out)$"
That is less complicated and selects precisely what you are searching for.
Since we dogfood our personal instruments and the Cloud Logging workforce makes use of Cloud Logging for troubleshooting, our workforce has discovered it actually helpful and I hope it is as helpful to our prospects!
Able to get began with Cloud Logging?
Be mindful the following pointers from Dan that may velocity up your searches:
Add a useful resource kind and log title to your question each time attainable,
Maintain your chosen time vary as slender as attainable.
If that what you’re searching for is a part of a particular subject, search on that subject fairly than utilizing a world search.
Use regex to carry out case delicate searches or superior sample matching in opposition to string fields. Substring and international search are at all times case insensitive.
Add highly-queried information fields into the listed “labels” subject.
Head over to the Logs Viewer to check out the following pointers in addition to the brand new regex assist.