SUSE Support

Here When You Need Us

How to collect kube-api audit logs with rancher-logging for an RKE/RKE2/K3S cluster

This document (000021022) is provided subject to the disclaimer at the end of this document.

Environment

RKE/RKE2/K3S

Situation

kube-api server audit logs are usually placed in a different directory than the one configured for rancher-logging when collecting

Resolution

By configuring the following, you can enable the kube-api server audit logs collection from rancher-logging helm charts. The rancher-logging helm chart has it disabled by default:

RKE:

kubeAudit:
    auditFilename: 'audit-log.json'
    enabled: enabled
    fluentbit:
      logTag: kube-audit
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/controlplane
          value: 'true'
        - effect: NoExecute
          key: node-role.kubernetes.io/etcd
          value: 'true'
    pathPrefix: '/var/log/kube-audit'

 

RKE2:

kubeAudit:
    auditFilename: 'audit.log'
    enabled: enabled
    fluentbit:
      logTag: kube-audit
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/controlplane
          value: 'true'
        - effect: NoExecute
          key: node-role.kubernetes.io/etcd
          value: 'true'
    pathPrefix: '/var/lib/rancher/rke2/server/logs'

 

k3s:

kubeAudit:
    auditFilename: 'audit.log'
    enabled: enabled
    fluentbit:
      logTag: kube-audit
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/controlplane
          value: 'true'
        - effect: NoExecute
          key: node-role.kubernetes.io/etcd
          value: 'true'
    pathPrefix: '/var/lib/rancher/k3s/server/logs'

 

Cause

The kube-api server audit logs aren't collected by rancher-logging as they are placed outside of the directory parsed by the logging operator by default

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000021022
  • Creation Date: 27-Mar-2024
  • Modified Date:27-Mar-2024
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.