Alert settings in Yandex Monitoring
In this tutorial, you will learn how to track trail status using dashboards and Yandex Monitoring alerts.
This guide assumes that you already have deployed your infrastructure:
- Created Yandex Cloud resources to collect security events for.
- Created a trail in Audit Trails to collect events.
- Configured the target to store and manage events: a bucket, datastream, or log group.
To start tracking the status of trails:
If you no longer need the resources, delete them.
Set up alerts
Create a notification channel
To get notifications about a triggered alert:
- In the management console
, select the folder where you want to create a notification channel. - Select Monitoring.
- In the left-hand panel, select Notification channels.
- In the top-right corner, click Create channel.
- Specify the channel settings:
- In the Name field, specify
alerts-channel. - In the Method field, specify the notification method.
- In the Recipients field, list notification recipients.
- In the Name field, specify
- Click Create.
The channel will appear in the list.
Add alerts
You can set up one or more alerts.
For more information about how to create alerts and about alert parameters, see the Yandex Monitoring documentation.
Deactivating a trail
The alert will send a notification that the trail is being deactivated.
- In the management console
, select the folder where you want to create an alert. - Select Monitoring.
- In the left-hand panel, select Alerts.
- In the top-right corner, click Create alert.
- In the Name field, specify
deactivating-trail-alert. - Under Metrics, click
to the right of the folder name and specify:service = Audit Trails.name = trail.status.status != ACTIVE.trail = <trail_name>.
- Under Alert parameters, specify:
- Condition:
Not equals to. - Alarm:
0.
- Condition:
- Under Notification channels, click Add channel and select the previously created notification channel.
- Click Create alert.
The alert is created.
Stopping delivery of audit logs to destination object
The alert will send notification that the trail has stopped uploading audit logs to its destination object, for example, due to a lack of free space in the bucket.
The Evaluation window parameter depends on the specific trail. The type and number of resources within the audit trail logging section will define the frequency for uploading audit logs to the destination object.
- In the management console
, select the folder where you want to create an alert. - Select Monitoring.
- In the left-hand panel, select Alerts.
- In the top-right corner, click Create alert.
- In the Name field, specify
stopping-logs-alert. - Under Metrics, click
to the right of the folder name and specify:service = Audit Trails.name = trail.delivered_events_count.trail = <trail_name>.
- Under Alert parameters, specify:
- Condition:
Equals to. - Alarm:
0. - Evaluation window:
<trail_value>.
- Condition:
- Under Notification channels, click Add channel and select the previously created notification channel.
- Click Create alert.
The alert is created.
Modifying the number of trails
The alert will send a notification that the number of trails in a cloud has changed.
- In the management console
, select the folder where you want to create an alert. - Select Monitoring.
- In the left-hand panel, select Alerts.
- In the top-right corner, click Create alert.
- In the Name field, specify
number-trails-alert. - Under Metrics, click
to the right of the folder name and specify:service = Audit Trails.name = quota.trails_count.usage.
- Under Alert parameters, specify:
- Condition:
Not equals to. - Alarm:
<number_of_trails>.
- Condition:
- Under Notification channels, click Add channel and select the previously created notification channel.
- Click Create alert.
Nearing cloud trail quota
The alert will send a notification that the number of trails used per cloud consumed over 80% of the quota.
- In the management console
, select the folder where you want to create an alert. - Select Monitoring.
- In the left-hand panel, select Alerts.
- In the top-right corner, click Create alert.
- In the Name field, specify
trail-quota-alert. - Under Metrics, click
to the right of the folder name and specify:service = Audit Trails.name = quota.trails_count.usage.
- Under Alert parameters, specify:
- Condition:
Greater than. - Alarm:
<number_equal_to_80%_of_quota>.
- Condition:
- Under Notification channels, click Add channel and select the previously created notification channel.
- Click Create alert.
Unauthorized access attempts
The alert will send a notification that an unauthorized request has been sent to one of the trail resources.
- In the management console
, select the folder where you want to create an alert. - Select Monitoring.
- In the left-hand panel, select Alerts.
- In the top-right corner, click Create alert.
- In the Name field, specify
unauthorized-access-alert. - Under Metrics, click
to the right of the folder name and specify:service = Audit Trails.name = trail.unauthorized_events_count.
- Under Alert parameters, specify:
- Condition:
Greater than. - Alarm:
0.
- Condition:
- Under Notification channels, click Add channel and select the previously created notification channel.
- Click Create alert.
Set up a dashboard
Create a dashboard
- In the management console
, select the folder the trails are in. - In the list of services, select Monitoring.
- Navigate to the Dashboards tab.
- Click Create.
- Click Save at the top right.
- In the window that opens, enter a name for the dashboard, e.g.,
missing-events, and click Save.
Create a chart for missed event monitoring
You can monitor missed events using Audit Trails metrics:
trail.processed_events_count: Rate at which the events are accepted for processing.trail.delivered_events_count: Event delivery rate to the destination object.
Copy a ready-to-use chart for missed event monitoring to your dashboard:
-
Open the trail dashboard in Monitoring:
Management console-
In the management console
, select Audit Trails. -
In the left-hand panel, select
Trails. -
Select the trail you need.
-
Go to the
Monitoring panel for the selected trail. -
Click Open in Monitoring at the top right.
This will take you to the Monitoring interface.
-
-
Copy the chart:
Monitoring UI-
Find the Processed versus delivered events chart.
-
To the right of the chart name, click
→ Copy to another dashboard. -
Specify a name, e.g.,
Processed versus delivered events — <trail_name>. -
Select a cloud and folder, then specify the dashboard you created earlier.
-
Click Copy and edit.
This will open your dashboard with a new chart.
-
If you need to, follow the same steps to add charts from other trails to your dashboard.
Review the chart for missed event monitoring
Note that there may be a lag between Delivered events and Processed events. Normally, you may encounter short-term lags that are compensated soon. If you have observed a persistent delivery lag of one hour or longer, check the trail status and diagnostics logs.
Get the trail status
- In the management console
, select Audit Trails. - In the left-hand panel, select
Trails. - Select the trail. The Trail page will display detailed information about the trail.
The Active status during a persistent lag between Delivered events and Processed events means that the trail operates normally, but there are some other reasons why data is delivered to the destination object with delays. In this case, check the destination object status and logs:
- Getting bucket information and statistics
- Getting information about a log group
- Step-by-step guides for Data Streams
The Error status indicates a trail performance error. In which case, review the trail diagnostics log.
Review the trail diagnostics log
- In the management console
, select Audit Trails. - In the left-hand panel, select
Trails. - Select the trail.
- Navigate to the
Diagnostic log panel and review the log. - Read this troubleshooting guide.
Create a chart for the destination object
Apart from the chart for missed event monitoring, you can add a chart for the destination object:
-
Object Storage
Events can be missed if there is not enough space for storing logs, e.g, if a trail sends logs to a bucket of limited size. To monitor the available bucket space, create a chart for the
space_usagemetric and add themax-sizemetric as a threshold.The
max-sizemetric will not be available if the maximum bucket size is not specified. If so, you need to track the storage space per cloud quota usage on your own. -
Cloud Logging
Add a chart for the
group.service.ingested_records_per_secondmetric to the dashboard to display the actual rate of log ingestion into the log group. Comparing this value with theMaximum write speedquota helps determine whether the log stream is hitting its limit. The additionalgroup.service.ingest_requests_per_secondchart filtered byERRORstatus enables detecting write errors promptly. -
Data Streams: See the Yandex Managed Service for YDB tutorials: