Skip to main content

Privacera Documentation

Configuring audit logs for the AWS Lake Formation on PrivaceraCloud


Prerequisite: Before performing the following steps you must have an Amazon S3 bucket for storing the audit logs.


When enabling access audits through PrivaceraCloud Portal, you must enable CloudTrail from AWS. For more information, see AWS guidelines for cost management with CloudTrail.

Steps to enable audit logs in AWS Lake Formation:
  1. Create Trail in AWS cloud trail.

    1. Go to AWS Cloud trail service → DashboardCreate Trail.

    2. On the General Details page, provide the Trail name (such as LF_Cloud_Trail) of your choice.

    3. Provide the S3 storage location of your S3 bucket.


      Make note of the S3 bucket location for cloud trail logs. For Example, privacera-dev-bucket/AWSLogs/587946681758)

    4. Uncheck the Log file SSE-KMS encryption and Log file validation checkboxes. Click the Next button.

    5. On next page under Choose Log Events enable the checkbox for Management Events with the checkboxes for Read and Write as checked.

    6. Enable the checkbox for Log Events. In Data Events section, select the Data Event type as AWS Lake formation and Log Selector template as Log All Events.

    7. Click Next. Confirm the values and click Create Trail.

  2. Enable the audit log flag in PrivaceraCloud:

    Use the toggle to Enable access audits.

  3. Create a database and table for storing audit logs query results. For this, you can use AWS Athena.

    1. Create database:

      CREATE DATABASE lf_audit_db;
    2. Create table:

      (In the following query, the LOCATION is the Amazon S3 bucket location of the cloud trail logs.)

      CREATE EXTERNAL TABLE lf_audit_db.cloudtrail_logs (
          eventVersion STRING,
          userIdentity STRUCT<
              type: STRING,
              principalId: STRING,
              arn: STRING,
              accountId: STRING,
              invokedBy: STRING,
              accessKeyId: STRING,
              userName: STRING,
              sessionContext: STRUCT<
                  attributes: STRUCT<
                      mfaAuthenticated: STRING,
                      creationDate: STRING>,
                  sessionIssuer: STRUCT<
                      type: STRING,
                      principalId: STRING,
                      arn: STRING,
                      accountId: STRING,
                      userName: STRING>>>,
          eventTime STRING,
          eventSource STRING,
          eventName STRING,
          awsRegion STRING,
          sourceIpAddress STRING,
          userAgent STRING,
          errorCode STRING,
          errorMessage STRING,
          requestParameters STRING,
          responseElements STRING,
          additionalEventData STRING,
          requestId STRING,
          eventId STRING,
          resources ARRAY<STRUCT<
              arn: STRING,
              accountId: STRING,
              type: STRING>>,
          eventType STRING,
          apiVersion STRING,
          readOnly STRING,
          recipientAccountId STRING,
          serviceEventDetails STRING,
          sharedEventID STRING,
          vpcEndpointId STRING
      COMMENT 'CloudTrail table for lakeformation audit logs'
      LOCATION 's3://privacera-dev-bucket/AWSLogs/587946681758'
      TBLPROPERTIES ('classification'='cloudtrail');
  4. Configure the below properties for in the AWS Lake Formation connector:



    PrivaceraCloud custom property

    Privacera Platform property

    AWS Athena Region

    Specifies AWS Athena region to create JDBC connection for AWS Lake Formation audit logs database. If not specified, will default to use the first region from AWS Regions property.



    AWS Athena Endpoint

    Specifies AWS Athena endpoint to create JDBC connection for AWS Lake Formation audit logs database. If not specified, will create an endpoint with default region from the region property.



    AWS Athena Workgroup

    Specifies AWS Athena workgroup to create JDBC connection for AWS Lake Formation audit logs database.



    Audit Database Name

    Specifies AWS audit database to store AWS Lake Formation audit logs.<audit_db_name>


    Audit Table Name

    Specifies AWS audit table to store AWSLake formation audit logs.<audit_table_name>


    AWS Athena S3 output location

    Specifies S3 location to store the access audit logs query results.



  5. There are two additional optional properties used to restrict collecting audit logs for excluding specific users and specific access types:



    PrivaceraCloud custom property

    Privacera Platform property

    Audit Excluded Users

    Specifies a list of users to exclude when fetching access audits.



    Audit Excluded Access type

    Specifies a list of list of access types to exclude when fetching access audits.

    For example: StartQueryExecution, GetTable,DeleteTable, CreateTable, CreateDatabase.