

# Monitoring License Manager
Monitoring License Manager

You can monitor the usage of licenses and subscriptions tracked in AWS License Manager using Amazon CloudWatch. CloudWatch collects raw data and processes it into readable, near real-time metrics. You can set alarms that watch for certain thresholds, and send notifications or take actions when those thresholds are met. For more information, see [Monitoring License Manager with Amazon CloudWatch](monitoring-cloudwatch.md).

You can capture API calls and related events made by or on behalf of your AWS account using AWS CloudTrail. Events are captured as log files and delivered to an Amazon S3 bucket that you specify. You can identify which users and accounts called AWS, the source IP address from which the calls were made, and when the calls occurred. For more information, see [Logging AWS License Manager API calls using AWS CloudTrail](logging-using-cloudtrail.md).

**Contents**
+ [

# Monitoring License Manager with Amazon CloudWatch
](monitoring-cloudwatch.md)
  + [

## Creating alarms to monitor License Manager metrics
](monitoring-cloudwatch.md#monitoring-cloudwatch-alarms)
+ [

# Logging AWS License Manager API calls using AWS CloudTrail
](logging-using-cloudtrail.md)
  + [

# License Manager information in CloudTrail
](license-manager-info-in-cloudtrail.md)
  + [

# Understanding License Manager log file entries
](understanding-license-manager-entries.md)

# Monitoring License Manager with Amazon CloudWatch
Monitoring with CloudWatch

You can monitor metric statistics for License Manager by using Amazon CloudWatch. These statistics are kept for 15 months, so that you can access historical information and gain a better perspective on how your web application or service is performing. You can set alarms that watch for certain thresholds and send notifications or take actions when those thresholds are met. For example, you can watch for the percentage of licenses using the `LicenseConfigurationUsagePercentage` metric, and take action before limits are exceeded. For more information, see the [Amazon CloudWatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/).

License Manager emits the following metrics hourly in the `AWSLicenseManager/licenseUsage` namespace:


| Metric | Description | 
| --- | --- | 
| RunningInstancesCount |  The total number of instances running in the current account that are grouped by the subscription name. Units: Count Dimensions: `SubscriptionName`: The name of the subscription.  | 
| AggregateRunningInstancesCount |  The aggregated total number of instances that are running across all of your accounts in AWS Organizations in the current AWS Region.Units: CountDimensions: `SubscriptionName`: The name of the subscription. | 
| TotalLicenseConfigurationUsageCount | The total number of a license configuration that could be available. Units: CountDimensions:[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/license-manager/latest/userguide/monitoring-cloudwatch.html)  | 
|  LicenseConfigurationUsageCount  | The total number of used licenses of this configuration.Units: CountDimensions:[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/license-manager/latest/userguide/monitoring-cloudwatch.html)  | 
| LicenseConfigurationUsagePercentage |  The used licenses of this license configuration expressed as a percentage. Units: Percent Dimensions: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/license-manager/latest/userguide/monitoring-cloudwatch.html)  | 
| InstanceCount |  Number of instances within a license asset group. Units: Count Dimensions: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/license-manager/latest/userguide/monitoring-cloudwatch.html)  | 
| InstanceConsumedLicenseCount |  Number of consumed licenses for instances within a license asset group. Units: Count Dimensions: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/license-manager/latest/userguide/monitoring-cloudwatch.html)  | 

## Creating alarms to monitor License Manager metrics
Creating CloudWatch alarms

You can create a CloudWatch alarm that sends an Amazon Simple Notification Service (Amazon SNS) message when the value of the metric changes and causes the alarm to change state. An alarm watches a metric over a time period you specify, and performs actions based on the value of the metric relative to a given threshold over a number of time periods. Alarms invoke actions for sustained state changes only. CloudWatch alarms do not invoke actions simply because they are in a particular state; the state must have changed and been maintained for a specified number of periods. For more information, see [Using CloudWatch alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html).

# Logging AWS License Manager API calls using AWS CloudTrail
CloudTrail logs

AWS License Manager is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in License Manager. CloudTrail captures all API calls for License Manager as events. The calls captured include calls from the License Manager console and code calls to the License Manager API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for License Manager. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in **Event history**. Using the information collected by CloudTrail, you can determine the request that was made to License Manager, the IP address from which the request was made, who made the request, when it was made, and additional details.

To learn more about CloudTrail, see the [AWS CloudTrail User Guide](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html).

**Topics**
+ [

# License Manager information in CloudTrail
](license-manager-info-in-cloudtrail.md)
+ [

# Understanding License Manager log file entries
](understanding-license-manager-entries.md)

# License Manager information in CloudTrail


CloudTrail is enabled on your AWS account when you create the account. When activity occurs in License Manager, that activity is recorded in a CloudTrail event along with other AWS service events in **Event history**. You can view, search, and download recent events in your AWS account. For more information, see [Viewing events with CloudTrail Event history](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html).

For an ongoing record of events in your AWS account, including events for License Manager, create a trail. A *trail* enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all AWS Regions. The trail logs events from all Regions in the AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following:
+ [Overview for creating a trail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html)
+ [CloudTrail supported services and integrations](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-aws-service-specific-topics.html)
+ [Configuring Amazon SNS notifications for CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/configure-sns-notifications-for-cloudtrail.html)
+ [Receiving CloudTrail log files from multiple regions](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/receive-cloudtrail-log-files-from-multiple-regions.html) and [Receiving CloudTrail log files from multiple accounts](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-receive-logs-from-multiple-accounts.html)

All License Manager actions are logged by CloudTrail and are documented in the [AWS License Manager API Reference](https://docs.aws.amazon.com/license-manager/latest/APIReference/). For example, calls to the calls to the `CreateLicenseConfiguration`, `ListResourceInventory` and `DeleteLicenseConfiguration` actions generate entries in the CloudTrail log files.

Every event or log entry contains information about who generated the request. The identity information helps you determine the following:
+ Whether the request was made with root or AWS Identity and Access Management (IAM) user credentials.
+ Whether the request was made with temporary security credentials for a role or federated user.
+ Whether the request was made by another AWS service.

For more information, see the [CloudTrail userIdentity element](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html).

# Understanding License Manager log file entries


A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so they don't appear in any specific order.

The following example shows a CloudTrail log entry that demonstrates the `DeleteLicenseConfiguration` action.

```
{
   "eventVersion":"1.05",
   "userIdentity":{
      "type":"IAMUser",
      "principalId":"AIDAIF2U5EXAMPLEH5AP6",
      "arn":"arn:aws:iam::123456789012:user/Administrator",
      "accountId":"O12345678901",
      "accessKeyId":"AKIDEXAMPLE",
      "userName":"Administrator"
   },
   "eventTime":"2019-02-15T06:48:37Z",
   "eventSource":"license-manager.amazonaws.com",
   "eventName":"DeleteLicenseConfiguration",
   "awsRegion":"us-east-1",
   "sourceIPAddress":"203.0.113.83",
   "userAgent":"aws-cli/2.4.6 Python/3.8.8 Linux",
   "requestParameters":{
      "licenseConfigurationArn":"arn:aws:license-manager:us-east-1:123456789012:license-configuration:lic-9ab477f4bEXAMPLE55f3ec08a5423f77"
   },
   "responseElements":null,
   "requestID":"3366df5f-4166-415f-9437-c38EXAMPLE48",
   "eventID":"6c2c949b-1a81-406a-a0d7-52EXAMPLE5bd",
   "eventType":"AwsApiCall",
   "recipientAccountId":"O12345678901"
}
```