Skip to content

KubernetesPodOperator: Support log level parsing from pod container output #64820

Description

@barunpuri

Description

KubernetesPodOperator (KPO) reads stdout/stderr from pod containers and writes them to Airflow task logs. During ttitlhis process, all log lines are hardcoded to INFO level, making it impossible to distinguish between DEBUG, WARNING, and ERROR messages in the Airflow UI — regardless of what level the pod application originally emitted.
https://github.com/apache/airflow/blob/main/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py#L432-L450

Use case/motivation

  • A pod application logs ERROR: database connection failed, but the Airflow UI displays it as INFO. Users scrolling through thousands of log lines have no way to quickly spot the actual error.
  • A team configures Airflow's logging_level to suppress DEBUG output in production, but pod DEBUG logs still appear because KPO has already recorded them all as INFO.
  • An alerting pipeline watches Airflow task logs for ERROR-level entries to trigger PagerDuty notifications, but it never fires — because pod errors are indistinguishable from normal INFO output.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions