Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight log lines by keyword. #47507

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tirkarthi
Copy link
Contributor

Update API to return color_log_error_keywords and color_log_warning_keywords from airflow.cfg through config API. Then in frontend parse the log message to add color attribute to span tag based on the keyword.

Notes to self and review :

  1. The semantic tokens in light theme appear to be hard to read. I guess it could be due to the Code block adding some more background color.
  2. For task log preview I have disabled highlighting since it didn't make sense and it was already filtered by error/critical level.

airflow.cfg values to test as per the screenshot

color_log_error_keywords = error,exception,group
color_log_warning_keywords = utils

image

image

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Mar 7, 2025
@tirkarthi tirkarthi added the AIP-38 Modern Web Application label Mar 7, 2025
@bbovenzi
Copy link
Contributor

bbovenzi commented Mar 7, 2025

Yeah, we shoudl adjust those light mode colors. First, want to try a light Code background before playign with the text color?

We should also make sure this plays well with #47469. Maybe log source shouldn't be by color then?

Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this is -1 for me right now for the reasons below.

@@ -61,6 +61,10 @@ def get_configs() -> ConfigResponse:
"audit_view_included_events": conf.get("webserver", "audit_view_included_events", fallback=""),
"audit_view_excluded_events": conf.get("webserver", "audit_view_excluded_events", fallback=""),
"test_connection": conf.get("core", "test_connection", fallback="Disabled"),
"color_log_error_keywords": conf.get("logging", "color_log_error_keywords", fallback="").split(","),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. there's a conf.getlist function
  2. This is a UI setting, not a logging setting
  3. Now we have structured logging (where the log level comes form the "source" directly without needing to pase , I don't think we should be looking for keywords.
  4. I really really really REALLY don't want us to add more config options!

Also "Task succeded without error" would get highlighted as an error. Very prone to false positives.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a new configuration. This was already present in Airflow 2.10. This is a port of the implementation from the old UI to the new UI. We have use cases where we show logs from external systems like Spark, HDFS etc that are not structured from the triggerer as a log group like "::group::stdout". The keywords help in highlighting the relevant line and improves debugging.

Also "Task succeded without error" would get highlighted as an error. Very prone to false positives.

Agreed, this is like a simple ctrl+f in the browser and has been more useful than a hindrance,

Config docs : https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#color-log-error-keywords
Airflow 2.10 implementation : #37443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AIP-38 Modern Web Application area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants