
Create, update, or delete a Cloudtrail
create_trail(name, bucket, log_group = NULL, log_role = NULL,
global = FALSE, multi_region = FALSE, key_prefix = NULL,
sns_topic = NULL, kms = NULL, ...)update_trail(name, bucket = NULL, log_group = NULL, log_role = NULL,
global = NULL, key_prefix = NULL, sns_topic = NULL, ...)
delete_trail(name, ...)
A character string specifying the name of a Cloudtrail or the ARN for a Cloudtrail, or an object of class “aws_cloudtrail”.
A character string specifying the name of an S3 bucket to deposit Cloudtrail logs into. AWS recommends this be a dedicated bucket exclusively for Cloudtrail logs. In order to succeed, the bucket must have an appropriate policy (see documentation).
Optionally, a character string specifying 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.
Optionally, a character string specifying the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
Specifies whether the trail is publishing events from global services such as IAM to the log files.
A logical specifying whether the trail will cover all regions (TRUE) or only the region in which the trail is created (FALSE).
Optionally, a prefix for the log file names created by the trail.
Optionally, a character string specifying an AWS SNS topic, to which notifications will be sent when each new log file is created.
Optionally, a character string specifying a Key Management Service (KMS) key alias (of the form “alias/KEYALIAS”) or ARN to be used to encrypt logs.
Additional arguments passed to cloudtrailHTTP.
For create_trail and update_trail, a list. For delete_trail, a logical.
create_trail sets up a trail to log requests into a specified S3 bucket. A maximum of five trails can exist in a region.
update_trail can update specific details for a trail. The trail can be active at the time.
delete_trail deletes a trail.
http://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_CreateTrail.html
http://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_UpdateTrail.html
http://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_DeleteTrail.html
require("aws.s3")
# create a bucket
mybucket <- "mycloudtrailbucket"
stopifnot(put_bucket(mybucket))
# set bucket policy for CloudTrail
ctpolicy <- cloudtrail_s3policy(mybucket, "my_aws_id")
stopifnot(put_bucket_policy(mybucket, policy = ctpolicy))
# create a trail
trail <- create_trail("exampletrail", mybucket)
# confirm trail created
get_trails()
# start/stop logging to the trail
start_logging(trail)
stop_logging(trail)
# check trail status
trail_status(trail)
# delete trail
delete_trail(trail)
Run the code above in your browser using DataLab