@@ -159,9 +159,53 @@ If you followed all of the preceding steps, you'll receive email alerts when you
159
159
> [ !div class="mx-imgBorder"]
160
160
> ![ Screenshot that highlights the information needed to configure an email alert.] ( ../media/alert-20.png )
161
161
162
+
163
+ ### Example: Log query alert for near expiry certificates
164
+
165
+ You can set an alert to notify you about certificates which are about to expire.
166
+
167
+ 1 . Go to ** Logs** and paste below query in query window
168
+
169
+ ``` json
170
+ AzureDiagnostics
171
+ | where OperationName =~ 'CertificateNearExpiryEventGridNotification'
172
+ | extend CertExpire = unixtime_seconds_todatetime(eventGridEventProperties_data_EXP_d)
173
+ | extend DaysTillExpire = datetime_diff("Day", now(), CertExpire)
174
+ | project ResourceId, CertName = eventGridEventProperties_subject_s, DaysTillExpire, CertExpire
175
+
176
+ 1 . Select **New alert rule**
177
+
178
+ > [!div class="mx-imgBorder"]
179
+ > 
180
+
181
+ 1 . In **Condition** tab use following configuration:
182
+ + In **Measurement** set **Aggregation granularity** to **1 day**
183
+ + In **Split by dimensions** set **Resource ID column** to **ResourceId**.
184
+ + Set **CertName** and **DayTillExpire** as dimensions.
185
+ + In **Alert logic** set **Threshold value** to **0** and **Frequency of evaluation** to **1 day**.
186
+
187
+ > [!div class="mx-imgBorder"]
188
+ > 
189
+
190
+ 1 . In **Actions** tab configure alert to send an email
191
+ 1 . Select **create action group**
192
+ > [!div class="mx-imgBorder"]
193
+ > 
194
+ 1 . Configure **Create action group**
195
+ > [!div class="mx-imgBorder"]
196
+ > 
197
+ 1 . Configure **Notifications** to send an email
198
+ > [!div class="mx-imgBorder"]
199
+ > 
200
+ 1 . Configure **Details** to trigger **Warning** alert
201
+ > [!div class="mx-imgBorder"]
202
+ > 
203
+ 1 . Select **Review + create**
204
+
162
205
## Next steps
163
206
164
207
Use the tools that you set up in this article to actively monitor the health of your key vault:
165
208
166
209
- [Monitor Key Vault](monitor-key-vault.md)
167
210
- [Monitoring Key Vault data reference](monitor-key-vault-reference.md)
211
+ - [Create a log query alert for an Azure resource](../../azure-monitor//alerts/tutorial-log-alert.md)
0 commit comments