Logging AWS Support App in Slack API calls using AWS CloudTrail - AWS Support

Logging AWS Support App in Slack API calls using AWS CloudTrail

The AWS Support App in Slack is integrated with AWS CloudTrail. CloudTrail provides a record of actions taken by a user, role, or an AWS service in the AWS Support App. To create this record, CloudTrail captures all public API calls for AWS Support App as events. These captured calls include calls from the AWS Support App console, and code calls to the AWS Support App public API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket. These include events for AWS Support App. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history. You can use the information that CloudTrail collects to determine that the request that was made to AWS Support App. You can also learn the IP address where the call originated, who made the request, when it was made, and additional details.

To learn more about CloudTrail, see the AWS CloudTrail User Guide.

AWS Support App information in CloudTrail

When you create your AWS account, this activates CloudTrail on the account. When public API activity occurs in the AWS Support App, 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.

For an ongoing record of events in your AWS account, including events for AWS Support App, create a trail. 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 analyze further the event data collected in CloudTrail logs and act upon the data. For more information, see the following:

CloudTrail logs all public AWS Support App actions. These actions are also documented in the AWS Support App in Slack API Reference. For example, calls to the CreateSlackChannelConfiguration, GetAccountAlias and UpdateSlackChannelConfiguration 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.

Understanding AWS Support App 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. This means that the logs don't appear in any specific order.

Example : Log example for CreateSlackChannelConfiguration

The following example shows a CloudTrail log entry for the CreateSlackChannelConfiguration operation.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AIDACKCEVSQ6C2EXAMPLE:JaneDoe", "arn": "arn:aws:sts::111122223333:assumed-role/Administrator/JaneDoe", "accountId": "111122223333", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AIDACKCEVSQ6C2EXAMPLE", "arn": "arn:aws:iam::111122223333:role/Administrator", "accountId": "111122223333", "userName": "Administrator" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-02-26T01:37:57Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-02-26T01:48:20Z", "eventSource": "supportapp.amazonaws.com", "eventName": "CreateSlackChannelConfiguration", "awsRegion": "us-east-1", "sourceIPAddress": "205.251.233.183", "userAgent": "aws-cli/1.3.23 Python/2.7.6 Linux/2.6.18-164.el5", "requestParameters": { "notifyOnCreateOrReopenCase": true, "teamId": "T012ABCDEFG", "notifyOnAddCorrespondenceToCase": true, "notifyOnCaseSeverity": "all", "channelName": "troubleshooting-channel", "notifyOnResolveCase": true, "channelId": "C01234A5BCD", "channelRoleArn": "arn:aws:iam::111122223333:role/AWSSupportAppRole" }, "responseElements": null, "requestID": "d06df6ca-c233-4ffb-bbff-63470c5dc255", "eventID": "0898ce29-a396-444a-899d-b068f390c361", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }
Example : Log example for ListSlackChannelConfigurations

The following example shows a CloudTrail log entry for the ListSlackChannelConfigurations operation.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AIDACKCEVSQ6C2EXAMPLE:AWSSupportAppRole", "arn": "arn:aws:sts::111122223333:assumed-role/AWSSupportAppRole", "accountId": "111122223333", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AIDACKCEVSQ6C2EXAMPLE", "arn": "arn:aws:iam::111122223333:role/AWSSupportAppRole", "accountId": "111122223333", "userName": "AWSSupportAppRole" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-03-01T20:06:32Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-03-01T20:06:46Z", "eventSource": "supportapp.amazonaws.com", "eventName": "ListSlackChannelConfigurations", "awsRegion": "us-east-1", "sourceIPAddress": "72.21.217.131", "userAgent": "aws-cli/1.3.23 Python/2.7.6 Linux/2.6.18-164.el5", "requestParameters": null, "responseElements": null, "requestID": "20f81d63-31c5-4351-bd02-9eda7f76e7b8", "eventID": "70acb7fe-3f84-47cd-8c28-cc148ad06d21", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }
Example : Log example for GetAccountAlias

The following example shows a CloudTrail log entry for the GetAccountAlias operation.

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AIDACKCEVSQ6C2EXAMPLE:devdsk", "arn": "arn:aws:sts::111122223333:assumed-role/AWSSupportAppRole/devdsk", "accountId": "111122223333", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AIDACKCEVSQ6C2EXAMPLE", "arn": "arn:aws:iam::111122223333:role/AWSSupportAppRole", "accountId": "111122223333", "userName": "AWSSupportAppRole" }, "webIdFederationData": {}, "attributes": { "creationDate": "2022-03-01T20:31:27Z", "mfaAuthenticated": "false" } } }, "eventTime": "2022-03-01T20:31:47Z", "eventSource": "supportapp.amazonaws.com", "eventName": "GetAccountAlias", "awsRegion": "us-east-1", "sourceIPAddress": "72.21.217.142", "userAgent": "aws-cli/1.3.23 Python/2.7.6 Linux/2.6.18-164.el5", "requestParameters": null, "responseElements": null, "requestID": "a225966c-0906-408b-b8dd-f246665e6758", "eventID": "79ebba8d-3285-4023-831a-64af7de8d4ad", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }