Audit Logging

This topic describes audit logging in Tanzu Kubernetes Grid 2.

Overview

In Tanzu Kubernetes Grid, you can access the following audit logs:

Kubernetes Audit Logs

Kubernetes audit logs record requests to the Kubernetes API server.

Audit logs are enabled by default for the Supervisor and the workload clusters that it deploys.

To enable Kubernetes auditing on a standalone management cluster or a workload cluster it deploys, set the ENABLE_AUDIT_LOGGING variable to true before you deploy the cluster.

Kubernetes Audit Log Location

By default, audit log entries for a cluster are written to the following location on its control plane nodes:

  • Standalone management cluster and its workload clusters: /var/log/kubernetes/audit.log
  • Supervisor: /var/log/vmware/audit/kube-apiserver.log
  • Supervisor-deployed workload clusters: /var/log/kubernetes/kube-apiserver.log

You can customize these locations by setting --audit-log-path in the audit log configuration.

If you deploy Fluent Bit on the cluster, it will forward the logs to your log destination. For instructions, see Install Fluent Bit for Log Forwarding.

Kubernetes Audit Log Policy and Configuration

You can see the audit log configuration for a cluster, including the audit log location, in the following locations:

  • Standalone management cluster and its workload clusters:

    • /etc/kubernetes/audit-policy.yaml on control plane nodes
    • ~/.config/tanzu/tkg/providers/ytt/03_customizations/audit-logging/audit_logging.yaml on your bootstrap machine
  • Supervisor and its workload clusters: Kube API server settings in /etc/kubernetes/manifest/kube-apiserver.yaml on control plane nodes. For example:

    • Supervisor:

        - kube-apiserver
      [...]
        - --audit-log-maxage=30
        - --audit-log-maxbackup=10
        - --audit-log-maxsize=100
        - --audit-log-path=/var/log/vmware/audit/kube-apiserver.log
        - --audit-policy-file=/etc/vmware/wcp/audit-policy.yaml
      
    • Workload cluster:

        - kube-apiserver
      [...]
        - --audit-log-maxage=30
        - --audit-log-maxbackup=10
        - --audit-log-maxsize=100
        - --audit-log-path=/var/log/kubernetes/kube-apiserver.log
        - --audit-policy-file=/etc/kubernetes/extra-config/audit-policy.yaml
      

System Audit Logs for Nodes

When you deploy a standalone management or workload cluster, auditd is enabled on the cluster by default. You can access your system audit logs on each node in the cluster by navigating to /var/log/audit/audit.log.

If you deploy Fluent Bit on the cluster, it will forward these audit logs to your log destination. For instructions, see Install Fluent Bit for Log Forwarding.

check-circle-line exclamation-circle-line close-line
Scroll to top icon