☁️
CTHFM: Azure
  • Welcome
  • Getting Started
    • Account Setup
      • Account Creation Instructions
  • Azure Fundamentals
    • Azure Fundamentals Overview
      • Azure Documentation
      • Azure Entra
      • Azure Hierarchy
      • Identities
      • Azure Entra Roles
      • Azure RBAC
      • Azure Licensing Overview
        • Azure Entra ID Premium Licenses Comparison
      • Azure Shared Responsibility Model
      • Azure Frameworks
      • Azure Security Services
      • Conditional Access Policies
        • How Conditional Access Policies Work
        • Benefits of Conditional Access
        • Best Practices for Conditional Access
        • Conditions for Conditional Access
        • Conditional Access Controls
        • Sign-In Risk and Identity Protection
        • Conditional Access Session Control
        • Name Locations IP Location
      • Azure Quotas
      • Azure Tokens
        • Access Tokens
        • ID Tokens
        • Refresh Tokens
          • Invalidate Refresh Tokens
        • Primary Refresh Tokens
        • Continuous Access Evaluation (CAE)
        • Token Protection: Conditional Access (Public Preview)
  • Azure CLI
    • Introduction to Azure CLI
    • Installing Azure CLI
    • CLI Commands
    • Resource Group Management
    • Creating and Managing Resources with Azure CLI
    • Managing IAM
    • Azure CLI Automation
    • Monitoring and Troubleshooting in Azure CLI
    • Azure CLI Overview
      • Azure CLI: Linux
      • Azure CLI: Windows
      • Azure CLI: MacOS
  • KQL
    • KQL Overview
      • KQL Introduction
      • Data Types
      • Quick Reference
      • Render
      • Basic Queries
  • Powershell
    • PowerShell for Azure
      • Powershell Documentation
      • Powershell Basics
      • Understanding Powershell Variables
      • Understanding Cmdlets
      • Powershell Console & ISE
      • Powershell: Entra Module
        • Module Reference & Getting Started
      • Powershell: Azure Module
        • Installation Instructions
        • Powershell Azure CLI: Windows
        • Powershell Azure CLI: Linux
        • Powershell Azure CLI: MacOS
        • Example Azure Cmdlets
  • Bicep
    • Bicep File Structure
    • Variable Types
  • Azure Logging References
    • Logging
      • Log Retention Strategies
      • Azure Log Types
      • Azure Activity Logs
        • Administrative Event Schema
        • Service Health Notification Schema
        • Resource Health
        • Alert Category
        • Autoscale
        • Security
        • Recommendation
        • Policy
      • Entra ID Logging
        • Identity Based Logs
          • Audit Logs
          • Sign-In Logs
            • AADNonInteractiveUserSignInLogs
            • AADManagedIdentitySignInLogs
            • AADServicePrincipalSignInLogs
            • First Party Sign-In Activity
          • Provisioning Logs (AADProvisioningLogs)
          • Microsoft Graph Activity
          • Identity Protection
            • Risk Detections
            • AADRiskyServicePrincipals
            • AADRiskyUsers
            • AADUserRiskEvents
            • AADServicePrincipalRiskEvents
        • Additional Entra ID Logs
      • Azure Key Vault
        • Azure Key Vault Logging Overview
      • Network Watcher
        • RBAC Permissions
        • Flow Log Types
          • NSG Flow Log Schema
          • VNET Flow Log Schema
        • Enabling Logs
          • NSG Flow Logs
          • VNET Flow Logs
        • Packet Capture
          • Packet Capture: VM
          • Packet Capture: Scale Sets
      • Compute Resources
        • Azure Monitor Agent
        • VM Insights
          • VM Insights Tables
      • Storage Accounts
        • Storage Account Logging
          • File
            • Enable StorageFileLogs
            • StorageFileLogs
          • Blob
            • Enable Blob Logging
            • StorageBlobLogs
          • Queue
            • Enable Queue Logging
            • StorageQueueLogs Table
          • Table
            • Enable Table Logging
            • StorageTableLogs Table
      • Azure App Service
        • Log Types
        • Enabling Logging
      • Azure Monitor
        • Resource Logs
          • Resource Log Top Level Documentation
        • Log Analytics Workspace
          • Setup
        • Workbooks
        • Dashboards
        • Alerts
        • Azure Monitor Documentation
      • Defender for Cloud
      • Intune
      • Sysmon
      • Purview Audit Log Schema
      • Kubernetes Audit Log (AKS)
  • Threat Hunting
    • Threat Hunting in Azure
      • Threat Hunting Introduction
      • Threat Hunting Process
        • Hypothesis Generation
        • Investigation
        • Identification
        • Resolution & Follow Up
      • Pyramid of Pain
      • Azure Threat Hunting Ideas
      • Hands On Threat Hunting Examples
      • OSINT Feeds
  • Sigma
    • Sigma Rule Structure
  • Microsoft Defender TI
    • Microsoft Defender Threat Intelligence
      • Data Sets
      • Reputational Scoring
      • Analyst Insights
      • Microsoft Defender TI: Copilot Integration
  • MITRE Att&ck
    • MITRE Att&ck
      • MITRE Att&ck Concepts
      • MITRE Data Sources
      • MITRE Att&ck Mitigations
      • MITRE Att&ck: Azure
        • MITRE Att&CK: Azure Security Control Mapping
  • Microsoft Resources
    • Microsoft Incident Response Ninja Hub
    • Microsoft Defender XDR Ninja Hub
  • Azure Threat Research Matrix (ATRM)
  • Security Research & Resources
    • Azure Goat
    • Azure Security Research
      • Azure Related CVEs
  • Defender XDR
    • Defender XDR Overview
    • Defender XDR Licensing
    • Defender XDR Default Retention
    • Defender XDR Advanced Hunting Table Schemas
    • Automated Response Requirements
    • Supported Response Actions
  • Azure Sentinel
    • Sentinel Overview
    • Azure Sentinel Deployments
    • Supported Data
    • Workbook, Playbook, Notebook Comparison
    • Sentinel Workbooks
    • Entities
    • User and Entity Behavior Analytics
    • Anomaly Detection
    • Mult-Stage Attack Detection
    • Sentinel: Az CLI
  • Microsoft Defender
    • Microsoft Defender for Cloud References
    • Defender for Cloud: Az CLI
  • Azure Policy
    • Azure Policy
    • Azure Policy Components
    • Azure Policy Rules
    • Scope Azure Policy
    • Policy Assignments
    • Policy Effect
    • Initiative Definition
    • Policy Parameters
    • Remediation Task Structure
    • Use Cases for Azure Policy
    • Azure Policy: Az CLI
  • Intune
    • Intune Overview
    • Intune Licensing
    • Intune API Permission Scopes
    • Intune Sample Script Resources
  • Intune Logging
    • Configure Logging
    • Logging Schema References
    • Intune Queries and Resources
  • Windows Host Security
    • Windows System Architecture and OS Fundamentals
    • SysInternals
    • Basic vs Advanced Security Auditing
    • Sysmon
  • Adversary Emulation
    • AzureHound
    • AADInternals
      • Install
    • RoadTools
      • Install
    • Oh365UserFinder
    • GraphRunner
  • Incident Response
    • Incident Response
      • Azure IR Program Development Cheat Sheet
      • Azure IR Playbooks (MS Guidance)
      • Ransomware (MS Guidance)
  • Automation
    • Automation Overview
    • Logic Apps
      • How Logic Apps Work
      • Logic App Types
      • Triggers
      • Connectors
      • Conditional Logic and Control Flow
      • APIs in Logic Apps
      • Handling Large Workflows with Stateful Logic Apps
      • External Service Integration
      • Securing, Managing, and Scaling Azure Logic Apps
      • Logic Apps: Az CLI
  • Packet Analysis
    • Wireshark Cheatsheet
    • TShark Cheatsheet
    • TCPDUMP Cheatsheet
    • Protocol Analysis Basics
    • HTTP Response Code Cheatsheet
    • RFC Protocol Mappings
    • PCAP Acquisition
  • Detection Lab
    • Detection Lab Introduction
    • Account Creation Instructions
    • Enable MFA Within Azure Tenant
    • Create an Azure Admin With Cloud Shell
    • Setup and Install Instructions
  • VSCode and Code Setup
  • Deploying Code
  • Enabling Logs for Log Analytics Workspace
  • Logging Into Windows VM
  • Verifying Logs in Log Analytics Workspace
  • Creating Detections: Azure Monitor
  • Cost Management: Billing Alarms
Powered by GitBook
On this page
  • What Are Kubernetes Audit Logs?
  • Structure of a Kubernetes Audit Log Event
  • Key Fields You Should Know
  • Understanding Level
  • Understanding Stage
  • Example Scenarios You Can Detect in Audit Logs
  • Kubernetes Audit Policies
  • Common Verbs
  • In Summary
  1. Azure Logging References
  2. Logging

Kubernetes Audit Log (AKS)

What Are Kubernetes Audit Logs?

Kubernetes Audit Logs track all requests made to the Kubernetes API Server. They record what happened, when it happened, who made the request, and what the outcome was. Think of them as a security camera watching everything that hits your Kubernetes API.


Structure of a Kubernetes Audit Log Event

Each audit log event is a JSON object with several standard fields.

Here’s the main structure:

{
  "kind": "Event",
  "apiVersion": "audit.k8s.io/v1",
  "level": "RequestResponse",
  "timestamp": "2025-04-05T10:20:30Z",
  "auditID": "abc123-456def-789ghi",
  "stage": "ResponseComplete",
  "requestURI": "/api/v1/namespaces/default/pods",
  "verb": "create",
  "user": {
    "username": "system:serviceaccount:default:myserviceaccount",
    "groups": ["system:serviceaccounts", "system:authenticated"]
  },
  "sourceIPs": ["10.0.0.1"],
  "userAgent": "kubectl/v1.26.0 (linux/amd64)",
  "objectRef": {
    "resource": "pods",
    "namespace": "default",
    "name": "my-pod"
  },
  "responseStatus": {
    "metadata": {},
    "code": 201
  },
  "requestObject": { },
  "responseObject": { },
  "annotations": {
    "authorization.k8s.io/decision": "allow",
    "authorization.k8s.io/reason": "RBAC: allowed by RoleBinding"
  }
}

Key Fields You Should Know

Field
What It Means

kind

Always Event for audit logs

apiVersion

Audit log schema version (e.g., audit.k8s.io/v1)

level

Level of detail: Metadata, Request, RequestResponse

timestamp

When the request happened

auditID

Unique ID for tracking this event

stage

Stage of the request: RequestReceived, ResponseStarted, ResponseComplete, Panic

requestURI

API endpoint that was called

verb

Action performed: get, list, create, delete, patch, etc.

user

Identity of the user or service account making the request

sourceIPs

IP addresses of the client

userAgent

Client info (kubectl, dashboard, app, etc.)

objectRef

Which object (e.g., Pod, Service) was accessed

responseStatus

Status code (e.g., 200 OK, 201 Created, 403 Forbidden)

requestObject

The full object sent in the request (optional based on level)

responseObject

The full object returned in the response (optional based on level)

annotations

Extra info like why the request was allowed or denied (e.g., RBAC decision)

Understanding Level

The level field controls how much detail the audit log has:

Level
What is Captured

Metadata

Only metadata about the request (no body)

Request

Metadata + request body

RequestResponse

Metadata + request body + response body

None

No logging at all (usually not recommended)


Understanding Stage

The stage tells you how far the request got:

Stage
Meaning

RequestReceived

API Server got the request

ResponseStarted

Started sending the response

ResponseComplete

Finished sending the response

Panic

Server crashed while handling


Example Scenarios You Can Detect in Audit Logs

Scenario
What to Look For

Unauthorized Access Attempt

responseStatus.code = 403

Successful Pod Deletion

verb = delete and resource = pods and responseStatus.code = 200

Creating a Secret

verb = create and resource = secrets

Changing Roles or RoleBindings

resource = roles or rolebindings

Access from Suspicious IP

Unrecognized sourceIPs

Excessive API Calls (Brute Force)

Repeated requestURI hits in a short time


Kubernetes Audit Policies

You control what gets logged using an Audit Policy.

A policy tells Kubernetes:

  • Which users/resources to log

  • What level (Metadata, Request, etc.)

  • What stages (RequestReceived, ResponseComplete, etc.)

You define the audit policy in YAML format and pass it to the API Server using the --audit-policy-file flag.

Example of a simple policy:

yamlCopyEditapiVersion: audit.k8s.io/v1
kind: Policy
rules:
- level: RequestResponse
  verbs: ["create", "update", "delete"]
  resources:
  - group: ""
    resources: ["pods", "services"]

This policy logs all create, update, and delete actions on pods and services with full request and response data.

Common Verbs

Verb
Meaning
Example Use Case
Threat Hunting Tip

get

Read a single resource

kubectl get pod mypod

Very common. Look for get on secrets by unusual users.

list

Read multiple resources

kubectl get pods

Normal in day-to-day operations.

watch

Watch for changes

Used by apps/controllers.

Attackers might watch pods/nodes for recon.

create

Create a new resource

kubectl create deployment myapp

🚩 Critical to monitor — who’s creating new deployments/pods/roles?

delete

Delete a resource

kubectl delete pod mypod

🚩 Unexpected deletes can be destructive or hide attacks.

update

Update a resource

kubectl edit deployment myapp

🚩 Watch updates to sensitive resources like RBAC or Secrets.

patch

Partial update of a resource

kubectl patch deployment myapp

🚩 Sometimes used by attackers to escalate privileges quietly.

proxy

Access services through API server

kubectl proxy

🚩 Watch proxy use — it could mean someone is tunneling into your cluster.

bind

Bind a role to a user/service account

Rare outside of RBAC setup

🚩 Unauthorized bind could mean RBAC abuse.

impersonate

Act as another user/service account

Service Meshes sometimes do this

🚩 Rare — watch carefully for impersonations.


In Summary

Concept
Key Point

Audit Log Event

JSON object describing one API request

Key Fields

timestamp, user, verb, objectRef, responseStatus, etc.

Levels

Metadata, Request, RequestResponse

Stages

RequestReceived, ResponseStarted, ResponseComplete, Panic

Policy

Defines what is logged and at what detail level

Use Cases

Monitor security, investigate incidents, detect threats

Last updated 1 month ago