Reference documentation and code samples for the Stackdriver Logging V2 Client class CmekSettings.
Describes the customer-managed encryption key (CMEK) settings associated with
a project, folder, organization, billing account, or flexible resource.
Note: CMEK for the Log Router can currently only be configured for Google
Cloud organizations. Once configured, it applies to all projects and folders
in the Google Cloud organization.
See Enabling CMEK for Log
Router for
more information.
Generated from protobuf message google.logging.v2.CmekSettings
Namespace
Google \ Cloud \ Logging \ V2
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ name
string
Output only. The resource name of the CMEK settings.
↳ kms_key_name
string
The resource name for the configured Cloud KMS key. KMS key name format: "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]" For example: "projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key" To enable CMEK for the Log Router, set this field to a valid kms_key_name for which the associated service account has the required cloudkms.cryptoKeyEncrypterDecrypter roles assigned for the key. The Cloud KMS key used by the Log Router can be updated by changing the kms_key_name to a new valid key name or disabled by setting the key name to an empty string. Encryption operations that are in progress will be completed with the key that was in use when they started. Decryption operations will be completed using the key that was used at the time of encryption unless access to that key has been revoked. To disable CMEK for the Log Router, set this field to an empty string. See Enabling CMEK for Log Router for more information.
↳ kms_key_version_name
string
The CryptoKeyVersion resource name for the configured Cloud KMS key. KMS key name format: "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]/cryptoKeyVersions/[VERSION]" For example: "projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key/cryptoKeyVersions/1" This is a read-only field used to convey the specific configured CryptoKeyVersion of kms_key that has been configured. It will be populated in cases where the CMEK settings are bound to a single key version. If this field is populated, the kms_key is tied to a specific CryptoKeyVersion.
↳ service_account_id
string
Output only. The service account that will be used by the Log Router to access your Cloud KMS key. Before enabling CMEK for Log Router, you must first assign the cloudkms.cryptoKeyEncrypterDecrypter role to the service account that the Log Router will use to access your Cloud KMS key. Use GetCmekSettings to obtain the service account ID. See Enabling CMEK for Log Router for more information.
getName
Output only. The resource name of the CMEK settings.
Returns
Type
Description
string
setName
Output only. The resource name of the CMEK settings.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getKmsKeyName
The resource name for the configured Cloud KMS key.
KMS key name format:
"projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]"
For example:
"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"
To enable CMEK for the Log Router, set this field to a valid
kms_key_name for which the associated service account has the required
cloudkms.cryptoKeyEncrypterDecrypter roles assigned for the key.
The Cloud KMS key used by the Log Router can be updated by changing the
kms_key_name to a new valid key name or disabled by setting the key name
to an empty string. Encryption operations that are in progress will be
completed with the key that was in use when they started. Decryption
operations will be completed using the key that was used at the time of
encryption unless access to that key has been revoked.
To disable CMEK for the Log Router, set this field to an empty string.
See Enabling CMEK for Log
Router
for more information.
Returns
Type
Description
string
setKmsKeyName
The resource name for the configured Cloud KMS key.
KMS key name format:
"projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]"
For example:
"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"
To enable CMEK for the Log Router, set this field to a valid
kms_key_name for which the associated service account has the required
cloudkms.cryptoKeyEncrypterDecrypter roles assigned for the key.
The Cloud KMS key used by the Log Router can be updated by changing the
kms_key_name to a new valid key name or disabled by setting the key name
to an empty string. Encryption operations that are in progress will be
completed with the key that was in use when they started. Decryption
operations will be completed using the key that was used at the time of
encryption unless access to that key has been revoked.
To disable CMEK for the Log Router, set this field to an empty string.
See Enabling CMEK for Log
Router
for more information.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getKmsKeyVersionName
The CryptoKeyVersion resource name for the configured Cloud KMS key.
KMS key name format:
"projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]/cryptoKeyVersions/[VERSION]"
For example:
"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key/cryptoKeyVersions/1"
This is a read-only field used to convey the specific configured
CryptoKeyVersion of kms_key that has been configured. It will be
populated in cases where the CMEK settings are bound to a single key
version.
If this field is populated, the kms_key is tied to a specific
CryptoKeyVersion.
Returns
Type
Description
string
setKmsKeyVersionName
The CryptoKeyVersion resource name for the configured Cloud KMS key.
KMS key name format:
"projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]/cryptoKeyVersions/[VERSION]"
For example:
"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key/cryptoKeyVersions/1"
This is a read-only field used to convey the specific configured
CryptoKeyVersion of kms_key that has been configured. It will be
populated in cases where the CMEK settings are bound to a single key
version.
If this field is populated, the kms_key is tied to a specific
CryptoKeyVersion.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getServiceAccountId
Output only. The service account that will be used by the Log Router to
access your Cloud KMS key.
Before enabling CMEK for Log Router, you must first assign the
cloudkms.cryptoKeyEncrypterDecrypter role to the service account that
the Log Router will use to access your Cloud KMS key. Use
GetCmekSettings to
obtain the service account ID.
See Enabling CMEK for Log
Router
for more information.
Returns
Type
Description
string
setServiceAccountId
Output only. The service account that will be used by the Log Router to
access your Cloud KMS key.
Before enabling CMEK for Log Router, you must first assign the
cloudkms.cryptoKeyEncrypterDecrypter role to the service account that
the Log Router will use to access your Cloud KMS key. Use
GetCmekSettings to
obtain the service account ID.
See Enabling CMEK for Log
Router
for more information.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Stackdriver Logging V2 Client - Class CmekSettings (1.32.3)\n\nVersion latestkeyboard_arrow_down\n\n- [1.32.3 (latest)](/php/docs/reference/cloud-logging/latest/V2.CmekSettings)\n- [1.32.2](/php/docs/reference/cloud-logging/1.32.2/V2.CmekSettings)\n- [1.31.3](/php/docs/reference/cloud-logging/1.31.3/V2.CmekSettings)\n- [1.30.3](/php/docs/reference/cloud-logging/1.30.3/V2.CmekSettings)\n- [1.29.0](/php/docs/reference/cloud-logging/1.29.0/V2.CmekSettings)\n- [1.28.5](/php/docs/reference/cloud-logging/1.28.5/V2.CmekSettings)\n- [1.27.1](/php/docs/reference/cloud-logging/1.27.1/V2.CmekSettings)\n- [1.26.0](/php/docs/reference/cloud-logging/1.26.0/V2.CmekSettings)\n- [1.25.5](/php/docs/reference/cloud-logging/1.25.5/V2.CmekSettings)\n- [1.24.10](/php/docs/reference/cloud-logging/1.24.10/V2.CmekSettings) \nReference documentation and code samples for the Stackdriver Logging V2 Client class CmekSettings.\n\nDescribes the customer-managed encryption key (CMEK) settings associated with\na project, folder, organization, billing account, or flexible resource.\n\nNote: CMEK for the Log Router can currently only be configured for Google\nCloud organizations. Once configured, it applies to all projects and folders\nin the Google Cloud organization.\nSee [Enabling CMEK for Log\nRouter](https://cloud.google.com/logging/docs/routing/managed-encryption) for\nmore information.\n\nGenerated from protobuf message `google.logging.v2.CmekSettings`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Logging \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nOutput only. The resource name of the CMEK settings.\n\n### setName\n\nOutput only. The resource name of the CMEK settings.\n\n### getKmsKeyName\n\nThe resource name for the configured Cloud KMS key.\n\nKMS key name format:\n\"projects/\\[PROJECT_ID\\]/locations/\\[LOCATION\\]/keyRings/\\[KEYRING\\]/cryptoKeys/\\[KEY\\]\"\nFor example:\n`\"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key\"`\nTo enable CMEK for the Log Router, set this field to a valid\n`kms_key_name` for which the associated service account has the required\ncloudkms.cryptoKeyEncrypterDecrypter roles assigned for the key.\nThe Cloud KMS key used by the Log Router can be updated by changing the\n`kms_key_name` to a new valid key name or disabled by setting the key name\nto an empty string. Encryption operations that are in progress will be\ncompleted with the key that was in use when they started. Decryption\noperations will be completed using the key that was used at the time of\nencryption unless access to that key has been revoked.\nTo disable CMEK for the Log Router, set this field to an empty string.\nSee [Enabling CMEK for Log\nRouter](https://cloud.google.com/logging/docs/routing/managed-encryption)\nfor more information.\n\n### setKmsKeyName\n\nThe resource name for the configured Cloud KMS key.\n\nKMS key name format:\n\"projects/\\[PROJECT_ID\\]/locations/\\[LOCATION\\]/keyRings/\\[KEYRING\\]/cryptoKeys/\\[KEY\\]\"\nFor example:\n`\"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key\"`\nTo enable CMEK for the Log Router, set this field to a valid\n`kms_key_name` for which the associated service account has the required\ncloudkms.cryptoKeyEncrypterDecrypter roles assigned for the key.\nThe Cloud KMS key used by the Log Router can be updated by changing the\n`kms_key_name` to a new valid key name or disabled by setting the key name\nto an empty string. Encryption operations that are in progress will be\ncompleted with the key that was in use when they started. Decryption\noperations will be completed using the key that was used at the time of\nencryption unless access to that key has been revoked.\nTo disable CMEK for the Log Router, set this field to an empty string.\nSee [Enabling CMEK for Log\nRouter](https://cloud.google.com/logging/docs/routing/managed-encryption)\nfor more information.\n\n### getKmsKeyVersionName\n\nThe CryptoKeyVersion resource name for the configured Cloud KMS key.\n\nKMS key name format:\n\"projects/\\[PROJECT_ID\\]/locations/\\[LOCATION\\]/keyRings/\\[KEYRING\\]/cryptoKeys/\\[KEY\\]/cryptoKeyVersions/\\[VERSION\\]\"\nFor example:\n`\"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key/cryptoKeyVersions/1\"`\nThis is a read-only field used to convey the specific configured\nCryptoKeyVersion of `kms_key` that has been configured. It will be\npopulated in cases where the CMEK settings are bound to a single key\nversion.\nIf this field is populated, the `kms_key` is tied to a specific\nCryptoKeyVersion.\n\n### setKmsKeyVersionName\n\nThe CryptoKeyVersion resource name for the configured Cloud KMS key.\n\nKMS key name format:\n\"projects/\\[PROJECT_ID\\]/locations/\\[LOCATION\\]/keyRings/\\[KEYRING\\]/cryptoKeys/\\[KEY\\]/cryptoKeyVersions/\\[VERSION\\]\"\nFor example:\n`\"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key/cryptoKeyVersions/1\"`\nThis is a read-only field used to convey the specific configured\nCryptoKeyVersion of `kms_key` that has been configured. It will be\npopulated in cases where the CMEK settings are bound to a single key\nversion.\nIf this field is populated, the `kms_key` is tied to a specific\nCryptoKeyVersion.\n\n### getServiceAccountId\n\nOutput only. The service account that will be used by the Log Router to\naccess your Cloud KMS key.\n\nBefore enabling CMEK for Log Router, you must first assign the\ncloudkms.cryptoKeyEncrypterDecrypter role to the service account that\nthe Log Router will use to access your Cloud KMS key. Use\nGetCmekSettings to\nobtain the service account ID.\nSee [Enabling CMEK for Log\nRouter](https://cloud.google.com/logging/docs/routing/managed-encryption)\nfor more information.\n\n### setServiceAccountId\n\nOutput only. The service account that will be used by the Log Router to\naccess your Cloud KMS key.\n\nBefore enabling CMEK for Log Router, you must first assign the\ncloudkms.cryptoKeyEncrypterDecrypter role to the service account that\nthe Log Router will use to access your Cloud KMS key. Use\nGetCmekSettings to\nobtain the service account ID.\nSee [Enabling CMEK for Log\nRouter](https://cloud.google.com/logging/docs/routing/managed-encryption)\nfor more information."]]