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