Tools for working with audit logs
You can upload audit logs to a Yandex Object Storage bucket, Yandex Cloud Logging log group, or Yandex Data Streams data stream.
Depending on the log location, you need to use different tools to view them and search for events:
Yandex Query
Use Query to work with logs uploaded to a bucket or a data stream:
- If logs reside in a bucket, you can use analytical YQL queries to analyze Yandex Cloud resource events.
- If logs reside in a data stream, use streaming YQL queries to analyze Yandex Cloud resource events.
To use Yandex Query, set up a data binding based on the target object:
-
Create a service account named
bucket-yq-sa
. -
Assign the
bucket-yq-sa
service account thestorage.viewer
role for the folder containing the bucket with logs. -
Create a connection.
- In the management console
, select the folder housing the trail that delivers logs to the bucket. - Select Audit Trails.
- Select the trail that delivers logs to the bucket.
- Click Process in YQ.
- Select Service account
bucket-yq-sa
. - Leave other attributes as default.
- Click Create.
- In the management console
-
In the window with data binding options, click Create.
-
Send the appropriate query.
- Create a service account named
bucket-yq-sa
. - Assign the
yds.editor
role to thebucket-yq-sa
service account. - Create a connection. When creating it, specify the settings for the Data Streams connection type.
- Create federated credentials.
- Send the appropriate query.
Cloud Logging
Use Cloud Logging to work with logs uploaded to a log group.
You can filter records using the filer expression language to analyze Yandex Cloud resource events.
To use Cloud Logging:
- Read logs in the log group.
- Filter the logs as you need.
jq
Use jq
Buckets store logs as JSON files. This means you can analyze Yandex Cloud resource events by getting the required events from the files using jq
filters
To use jq
:
-
Install and set up s3fs or goofys to mount Object Storage buckets using FUSE
. -
Mount a bucket with audit logs to your file system using s3fs or goofys.
-
Install the jq
utility. -
Run the command with the relevant
jq
filter.
Note
Example commands for log operations use jq
together with find
, where find
provides all log files from the bucket for processing.