trails: Trails

Description Usage Arguments Details Value References See Also Examples

Description

Create, update, or delete a Cloudtrail

Usage

1
2
3
4
5
6
7
8
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, ...)

Arguments

name

A character string specifying the name of a Cloudtrail or the ARN for a Cloudtrail, or an object of class “aws_cloudtrail”.

bucket

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).

log_group

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.

log_role

Optionally, a character string specifying the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

global

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

multi_region

A logical specifying whether the trail will cover all regions (TRUE) or only the region in which the trail is created (FALSE).

key_prefix

Optionally, a prefix for the log file names created by the trail.

sns_topic

Optionally, a character string specifying an AWS SNS topic, to which notifications will be sent when each new log file is created.

kms

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.

Details

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.

Value

For create_trail and update_trail, a list. For delete_trail, a logical.

References

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

See Also

get_trails, trail_status, start_logging

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
  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)

## End(Not run)

cloudyr/aws.cloudtrail documentation built on Jan. 14, 2020, 4:54 a.m.