Dynamic Log Level for Kubernetes

Overview

Manage container log levels at runtime without restarting pods. The f5ops loglevel commands let you inspect, change, and reset logging verbosity for individual containers running in your cluster.

  • Valid log levels: TRACE, DEBUG, NOTICE, INFO, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY.

  • The nostdout field (ENABLED/DISABLED) silences a container’s stdout emission without changing its level. There is no dedicated flag on f5ops loglevel set — use patch, replace, or edit to configure it.

  • Permission: Only users with the f5-ops-admin role can execute the log level command. For details on role permissions,refer Available roles.

F5ops Plugin Commands

Command

Description

kubectl f5ops loglevel list

Lists all LogLevel resources in the namespace.

kubectl f5ops loglevel get <pod-name>

Retrieves a pod’s container log levels.

kubectl f5ops loglevel set <pod-name> <container> <level>

Sets a single container’s log level.

kubectl f5ops loglevel edit <pod-name>

Edits log levels interactively in the default editor.

kubectl f5ops loglevel replace -f <file>

Replaces log levels from a YAML or JSON file.

kubectl f5ops loglevel reset <pod-name>

Resets a pod’s log levels back to defaults.

Note:: Log Level can be abbreviated to ll

List Log Levels

kubectl f5ops loglevel list
kubectl get ll

Get Log Levels for a Specific Pod

kubectl f5ops loglevel get mypod
kubectl get ll mypod

Set a Container’s Log Level

kubectl f5ops loglevel set mypod c1 DEBUG
kubectl patch ll mypod --type=merge -p '{"spec":{"containers":[{"name":"c1","level":"DEBUG"}]}}'

To silence stdout without changing the level, use patch instead:

kubectl f5ops loglevel patch mypod --type=merge -p '{"spec":{"containers":[{"name":"c1","nostdout":"ENABLED"}]}}'
kubectl patch ll mypod --type=merge -p '{"spec":{"containers":[{"name":"c1","nostdout":"ENABLED"}]}}'

Replace Log Levels from a File

kubectl f5ops loglevel replace -f loglevel.yaml
kubectl replace -f loglevel.yaml

Edit Log Levels Interactively

kubectl f5ops loglevel edit mypod
kubectl edit ll mypod

Reset Log Levels

kubectl f5ops loglevel reset mypod
kubectl delete ll mypod