aws.cloudtrail

Filters

is-shadow

Identify shadow trails (secondary copies), shadow trails can’t be modified directly, the origin trail needs to be modified.

Shadow trails are created for multi-region trails as well for organizational trails.

properties:
  state:
    type: boolean
  type:
    enum:
    - is-shadow
required:
- type

status

Filter a cloudtrail by its status.

Example

policies:
  - name: cloudtrail-check-status
    resource: aws.cloudtrail
    filters:
    - type: status
      key: IsLogging
      value: False
properties:
  default:
    type: object
  key:
    type: string
  op:
    enum:
    - eq
    - equal
    - ne
    - not-equal
    - gt
    - greater-than
    - ge
    - gte
    - le
    - lte
    - lt
    - less-than
    - glob
    - regex
    - regex-case
    - in
    - ni
    - not-in
    - contains
    - difference
    - intersect
  type:
    enum:
    - status
  value:
    oneOf:
    - type: array
    - type: string
    - type: boolean
    - type: number
    - type: 'null'
  value_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      url:
        type: string
    required:
    - url
    type: object
  value_regex:
    type: string
  value_type:
    enum:
    - age
    - integer
    - expiration
    - normalize
    - size
    - cidr
    - cidr_size
    - swap
    - resource_count
    - expr
    - unique_size
    - date
    - version
required:
- type

Actions

delete

Delete a cloud trail

example

policies:
  - name: delete-cloudtrail
    resource: aws.cloudtrail
    filters:
     - type: value
       key: Name
       value: delete-me
       op: eq
    actions:
     - type: delete
properties:
  type:
    enum:
    - delete
required:
- type

set-logging

Set the logging state of a trail

Example

policies:
  - name: cloudtrail-set-active
    resource: aws.cloudtrail
    filters:
     - type: status
       key: IsLogging
       value: False
    actions:
     - type: set-logging
       enabled: True
properties:
  enabled:
    type: boolean
  type:
    enum:
    - set-logging
required:
- type

update-trail

Update trail attributes.

Example

policies:
  - name: cloudtrail-set-log
    resource: aws.cloudtrail
    filters:
     - or:
       - KmsKeyId: empty
       - LogFileValidationEnabled: false
    actions:
     - type: update-trail
       attributes:
         KmsKeyId: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef
         EnableLogFileValidation: true
properties:
  attributes:
    type: object
  type:
    enum:
    - update-trail
required:
- attributes