Hi,all.
In a log-based alert policy, I would like to use a label to include the time (timestamp) when the log was output in the email text.
I specified the field timestamp as the label and specified it in the Documentation with ${log.extracted_label.KEY}, but it is displayed as null in the email.
Please answer my questions.
1. Please teach me how to display the timestamp in the Documentation.
2. If 1 is successful, I would like to display only the date and only the time. Please teach me how to use regular expressions.
Hi @utayoshida,
Welcome to the Google Cloud Community!
The log.extracted_label.
variable can have null values
for the following reasons:
Here are a couple options on how you can resolve this:
If you plan to create a custom log-based alerting policy for timestamps, your code will depend on your application’s programming language and main use case. Here is a code sample to help you get started.
If you want to learn more about using regular expressions (regex) in Google Cloud, you may refer to these resources:
I hope this helps!