AWS CloudTrail

2014/11/11 - AWS CloudTrail - 4 updated api methods

CreateTrail (updated) Link ¶
Changes (both)
{'CloudWatchLogsLogGroupArn': 'string', 'CloudWatchLogsRoleArn': 'string'}

From the command line, use create-subscription .

Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.

Request Syntax

client.create_trail(
    Name='string',
    S3BucketName='string',
    S3KeyPrefix='string',
    SnsTopicName='string',
    IncludeGlobalServiceEvents=True|False,
    CloudWatchLogsLogGroupArn='string',
    CloudWatchLogsRoleArn='string'
)
type Name

string

param Name

[REQUIRED]

Specifies the name of the trail.

type S3BucketName

string

param S3BucketName

[REQUIRED]

Specifies the name of the Amazon S3 bucket designated for publishing log files.

type S3KeyPrefix

string

param S3KeyPrefix

Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.

type SnsTopicName

string

param SnsTopicName

Specifies the name of the Amazon SNS topic defined for notification of log file delivery.

type IncludeGlobalServiceEvents

boolean

param IncludeGlobalServiceEvents

Specifies whether the trail is publishing events from global services such as IAM to the log files.

type CloudWatchLogsLogGroupArn

string

param CloudWatchLogsLogGroupArn

Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. Not required unless you specify CloudWatchLogsRoleArn.

type CloudWatchLogsRoleArn

string

param CloudWatchLogsRoleArn

Specifies the role for the CloudWatch Logs endpoint to assume to write to a user’s log group.

rtype

dict

returns

Response Syntax

{
    'Name': 'string',
    'S3BucketName': 'string',
    'S3KeyPrefix': 'string',
    'SnsTopicName': 'string',
    'IncludeGlobalServiceEvents': True|False,
    'CloudWatchLogsLogGroupArn': 'string',
    'CloudWatchLogsRoleArn': 'string'
}

Response Structure

  • (dict) -- Returns the objects or data listed below if successful. Otherwise, returns an error.

    • Name (string) --

      Specifies the name of the trail.

    • S3BucketName (string) --

      Specifies the name of the Amazon S3 bucket designated for publishing log files.

    • S3KeyPrefix (string) --

      Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.

    • SnsTopicName (string) --

      Specifies the name of the Amazon SNS topic defined for notification of log file delivery.

    • IncludeGlobalServiceEvents (boolean) --

      Specifies whether the trail is publishing events from global services such as IAM to the log files.

    • CloudWatchLogsLogGroupArn (string) --

      Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs will be delivered.

    • CloudWatchLogsRoleArn (string) --

      Specifies the role for the CloudWatch Logs endpoint to assume to write to a user’s log group.

DescribeTrails (updated) Link ¶
Changes (response)
{'trailList': {'CloudWatchLogsLogGroupArn': 'string',
               'CloudWatchLogsRoleArn': 'string'}}

Retrieves settings for the trail associated with the current region for your account.

Request Syntax

client.describe_trails(
    trailNameList=[
        'string',
    ]
)
type trailNameList

list

param trailNameList

The trail returned.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'trailList': [
        {
            'Name': 'string',
            'S3BucketName': 'string',
            'S3KeyPrefix': 'string',
            'SnsTopicName': 'string',
            'IncludeGlobalServiceEvents': True|False,
            'CloudWatchLogsLogGroupArn': 'string',
            'CloudWatchLogsRoleArn': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    Returns the objects or data listed below if successful. Otherwise, returns an error.

    • trailList (list) --

      The list of trails.

      • (dict) --

        The settings for a trail.

        • Name (string) --

          Name of the trail set by calling CreateTrail.

        • S3BucketName (string) --

          Name of the Amazon S3 bucket into which CloudTrail delivers your trail files.

        • S3KeyPrefix (string) --

          Value of the Amazon S3 prefix.

        • SnsTopicName (string) --

          Name of the existing Amazon SNS topic that CloudTrail uses to notify the account owner when new CloudTrail log files have been delivered.

        • IncludeGlobalServiceEvents (boolean) --

          Set to True to include AWS API calls from AWS global services such as IAM. Otherwise, False .

        • CloudWatchLogsLogGroupArn (string) --

          Specifies an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered.

        • CloudWatchLogsRoleArn (string) --

          Specifies the role for the CloudWatch Logs endpoint to assume to write to a user’s log group.

GetTrailStatus (updated) Link ¶
Changes (response)
{'LatestCloudWatchLogsDeliveryError': 'string',
 'LatestCloudWatchLogsDeliveryTime': 'timestamp'}

Returns a JSON-formatted list of information about the specified trail. Fields include information on delivery errors, Amazon SNS and Amazon S3 errors, and start and stop logging times for each trail.

Request Syntax

client.get_trail_status(
    Name='string'
)
type Name

string

param Name

[REQUIRED]

The name of the trail for which you are requesting the current status.

rtype

dict

returns

Response Syntax

{
    'IsLogging': True|False,
    'LatestDeliveryError': 'string',
    'LatestNotificationError': 'string',
    'LatestDeliveryTime': datetime(2015, 1, 1),
    'LatestNotificationTime': datetime(2015, 1, 1),
    'StartLoggingTime': datetime(2015, 1, 1),
    'StopLoggingTime': datetime(2015, 1, 1),
    'LatestCloudWatchLogsDeliveryError': 'string',
    'LatestCloudWatchLogsDeliveryTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    Returns the objects or data listed below if successful. Otherwise, returns an error.

    • IsLogging (boolean) --

      Whether the CloudTrail is currently logging AWS API calls.

    • LatestDeliveryError (string) --

      Displays any Amazon S3 error that CloudTrail encountered when attempting to deliver log files to the designated bucket. For more information see the topic Error Responses in the Amazon S3 API Reference.

    • LatestNotificationError (string) --

      Displays any Amazon SNS error that CloudTrail encountered when attempting to send a notification. For more information about Amazon SNS errors, see the Amazon SNS Developer Guide.

    • LatestDeliveryTime (datetime) --

      Specifies the date and time that CloudTrail last delivered log files to an account's Amazon S3 bucket.

    • LatestNotificationTime (datetime) --

      Specifies the date and time of the most recent Amazon SNS notification that CloudTrail has written a new log file to an account's Amazon S3 bucket.

    • StartLoggingTime (datetime) --

      Specifies the most recent date and time when CloudTrail started recording API calls for an AWS account.

    • StopLoggingTime (datetime) --

      Specifies the most recent date and time when CloudTrail stopped recording API calls for an AWS account.

    • LatestCloudWatchLogsDeliveryError (string) --

      Displays any CloudWatch Logs error that CloudTrail encountered when attempting to deliver logs to CloudWatch Logs.

    • LatestCloudWatchLogsDeliveryTime (datetime) --

      Displays the most recent date and time when CloudTrail delivered logs to CloudWatch Logs.

UpdateTrail (updated) Link ¶
Changes (both)
{'CloudWatchLogsLogGroupArn': 'string', 'CloudWatchLogsRoleArn': 'string'}

From the command line, use update-subscription .

Updates the settings that specify delivery of log files. Changes to a trail do not require stopping the CloudTrail service. Use this action to designate an existing bucket for log delivery. If the existing bucket has previously been a target for CloudTrail log files, an IAM policy exists for the bucket.

Request Syntax

client.update_trail(
    Name='string',
    S3BucketName='string',
    S3KeyPrefix='string',
    SnsTopicName='string',
    IncludeGlobalServiceEvents=True|False,
    CloudWatchLogsLogGroupArn='string',
    CloudWatchLogsRoleArn='string'
)
type Name

string

param Name

[REQUIRED]

Specifies the name of the trail.

type S3BucketName

string

param S3BucketName

Specifies the name of the Amazon S3 bucket designated for publishing log files.

type S3KeyPrefix

string

param S3KeyPrefix

Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.

type SnsTopicName

string

param SnsTopicName

Specifies the name of the Amazon SNS topic defined for notification of log file delivery.

type IncludeGlobalServiceEvents

boolean

param IncludeGlobalServiceEvents

Specifies whether the trail is publishing events from global services such as IAM to the log files.

type CloudWatchLogsLogGroupArn

string

param CloudWatchLogsLogGroupArn

Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. Not required unless you specify CloudWatchLogsRoleArn.

type CloudWatchLogsRoleArn

string

param CloudWatchLogsRoleArn

Specifies the role for the CloudWatch Logs endpoint to assume to write to a user’s log group.

rtype

dict

returns

Response Syntax

{
    'Name': 'string',
    'S3BucketName': 'string',
    'S3KeyPrefix': 'string',
    'SnsTopicName': 'string',
    'IncludeGlobalServiceEvents': True|False,
    'CloudWatchLogsLogGroupArn': 'string',
    'CloudWatchLogsRoleArn': 'string'
}

Response Structure

  • (dict) -- Returns the objects or data listed below if successful. Otherwise, returns an error.

    • Name (string) --

      Specifies the name of the trail.

    • S3BucketName (string) --

      Specifies the name of the Amazon S3 bucket designated for publishing log files.

    • S3KeyPrefix (string) --

      Specifies the Amazon S3 key prefix that precedes the name of the bucket you have designated for log file delivery.

    • SnsTopicName (string) --

      Specifies the name of the Amazon SNS topic defined for notification of log file delivery.

    • IncludeGlobalServiceEvents (boolean) --

      Specifies whether the trail is publishing events from global services such as IAM to the log files.

    • CloudWatchLogsLogGroupArn (string) --

      Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs will be delivered.

    • CloudWatchLogsRoleArn (string) --

      Specifies the role for the CloudWatch Logs endpoint to assume to write to a user’s log group.