

# Monitoring the Secrets Manager extension in AWS Systems Manager Cloud Extensions

The extension sends its metrics to CloudWatch. For how to query the metrics and alarm on them, see [CloudWatch metrics](cloud-extensions-monitoring.md#cloud-extensions-monitoring-cloudwatch-metrics). After you add the extension to a profile, check the logs of the extension in CloudWatch Logs after your next invocation.

**Topics**
+ [Logs](#cloud-extensions-ext-secrets-manager-monitoring-logs)
+ [AWS CloudTrail](#cloud-extensions-ext-secrets-manager-monitoring-aws-cloudtrail)
+ [Extension metrics](#cloud-extensions-ext-secrets-manager-monitoring-extension-metrics)

## Logs
<a name="cloud-extensions-ext-secrets-manager-monitoring-logs"></a>

The extension writes logs through the runtime to stderr. Each log line includes the name of the extension. The logs are JSON in Lambda and text elsewhere. In Lambda, the logs go to CloudWatch Logs. In Lambda, set the log level with the `AWS_CLOUDEXTENSIONS_LOG_LEVEL` environment variable. The log lines of the extension never include secret values or the server-side request forgery (SSRF) token.

## AWS CloudTrail
<a name="cloud-extensions-ext-secrets-manager-monitoring-aws-cloudtrail"></a>

Requests to the extension don't appear in AWS CloudTrail. When the extension calls Secrets Manager, CloudTrail records the call with a user agent that contains `secretsmanager/version`.

## Extension metrics
<a name="cloud-extensions-ext-secrets-manager-monitoring-extension-metrics"></a>

The extension publishes the following OpenTelemetry metrics, under the scope `cloudwatch.aws/secretsmanager/cloudextensions`. The extension adds no dimensions of its own. Cloud Extensions attaches the attributes `extension.name` and `extension.version` to each data point.
+ `cache.hits` - Requests that the extension served from the cache
+ `cache.misses` - All other requests. This includes requests that waited for the refresh of another request, expired entries that the extension confirmed with `DescribeSecret`, and failed requests
+ `cache.entry.count` - The number of cached entries across all roles