Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions airflow-core/src/airflow/utils/serve_logs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,15 @@ def serve_logs(port=None):

port = port or conf.getint("logging", "WORKER_LOG_SERVER_PORT")

# If dual stack is available and IPV6_V6ONLY is not enabled on the socket
# then when IPV6 is bound to it will also bind to IPV4 automatically
if getattr(socket, "has_dualstack_ipv6", lambda: False)():
host = "::" # ASGI uses `::` syntax for IPv6 binding instead of the `[::]` notation used in WSGI, while preserving the `[::]` format in logs
if socket.has_dualstack_ipv6():
serve_log_uri = f"http://[::]:{port}"
else:
host = "0.0.0.0"
serve_log_uri = f"http://{host}:{port}"
serve_log_uri = f"http://0.0.0.0:{port}"

logger.info("Starting log server on %s", serve_log_uri)

# Use uvicorn directly for ASGI applications
uvicorn.run("airflow.utils.serve_logs.log_server:get_app", host=host, port=port, log_level="info")
uvicorn.run("airflow.utils.serve_logs.log_server:get_app", host="", port=port, log_level="info")
# Log serving is I/O bound and has low concurrency, so single process is sufficient


Expand Down