Configuring event export involves the following steps:
Preparing the environment for working with Yandex Cloud.
To manage the configuration, you need Yandex Cloud CLI; install and initialize it.
Note: by default, audit is performed in the Yandex Cloud folder specified in the CLI profile. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To configure the audit, you need an active billing account because a fee is charged for using the Yandex Cloud infrastructure.
To configure Yandex Cloud audit, you need an active billing account:
If you have an active billing account, you can create or select a Yandex Cloud folder in which your infrastructure will work, on the cloud page.
Creating a bucket for audit logs
To create a bucket:
The bucket is created.
Creating an encryption key in the Key Management Service
To create an encryption key:
The encryption key is created.
Enabling bucket encryption
To enable bucket encryption:
Bucket encryption is enabled.
Creating service accounts
To create service accounts (a separate account for the trail and a separate account for the bucket):
The service accounts are created.
Creating a static key
You will need the key ID and the private key when mounting the bucket. You can create a key using the management console or the CLI.
To create a key using the management console:
The static access key is created. The key value will become unavailable when you close the dialog.
To create a key using the CLI:
yc iam access-key create --service-account-name sa-kuma-bucket
Result:
access_key:
id: aje*******k2u
service_account_id: aje*******usm
created_at: "2022-09-22T14:37:51Z"
key_id: 0n8*******0YQ
secret: JyT*******zMP1
The access key is created.
Assigning roles to service accounts
To assign the audit-trails.viewer, storage.uploader, and kms.keys.encrypterDecrypter roles to the sa-kuma service account:
yc resource-manager folder add-access-binding \
--role audit-trails.viewer \
--id <folder_id> \
--service-account-id <service_account_id>
Where:
--role
is the assigned role.--id
is the ID of the 'example-folder' folder.--service-account-id
is the ID of the sa-kuma service account.yc resource-manager folder add-access-binding \
--role storage.uploader \
--id <folder_id> \
--service-account-id <service_account_id>
Where:
--role
is the assigned role.--id
is the ID of the 'example-folder' folder.--service-account-id
is the ID of the sa-kuma service account.yc kms symmetric-key add-access-binding \
--role kms.keys.encrypterDecrypter \
--id <key_id> \
--service-account-id <service_account_id>
Where:
--role
is the assigned role.--id
is the ID of the kuma-kms KMS key.--service-account-id
is the ID of the sa-kuma service account.To assign the storage.viewer and kms.keys.encrypterDecrypter roles to the sa-kuma-bucket service account:
yc resource-manager folder add-access-binding \
--id <folder_id> \
--role storage.viewer \
--service-account-id <service_account_id>
Where:
--id
is the ID of the 'example-folder' folder.--role
is the assigned role.--service-account-id
is the ID of the sa-kuma-bucket service account.yc kms symmetric-key add-access-binding \
--role kms.keys.encrypterDecrypter \
--id <key_id> \
--service-account-id <service_account_id>
Where:
--role
is the assigned role.--id
is the ID of the kuma-kms KMS key.--service-account-id
is the ID of the sa-kuma-bucket service account.Creating an audit trail
To create an audit trail:
Use a prefix if you store audit logs and third-party data in the same bucket. Do not use the same prefix for logs and other objects in the bucket because this may cause logs and third-party objects to overwrite each other.