Skip to content

Commit c97f0b3

Browse files
authored
Fix error in seeding elastic log_id template (apache#24960)
There was a mistake in seeding the elastic log id. We used hyphens instead of underscores
1 parent fee7782 commit c97f0b3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

airflow/utils/db.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,10 +835,15 @@ def log_template_exists():
835835
session.add(
836836
LogTemplate(
837837
filename="{{ ti.dag_id }}/{{ ti.task_id }}/{{ ts }}/{{ try_number }}.log",
838-
elasticsearch_id="{dag_id}-{task_id}-{execution_date}-{try_number}",
838+
elasticsearch_id="{dag_id}_{task_id}_{execution_date}_{try_number}",
839839
)
840840
)
841841
session.flush()
842+
wrong_log_id = "{dag_id}-{task_id}-{execution_date}-{try_number}"
843+
correct_log_id = "{dag_id}_{task_id}_{execution_date}_{try_number}"
844+
session.query(LogTemplate).filter(LogTemplate.elasticsearch_id == wrong_log_id).update(
845+
{LogTemplate.elasticsearch_id: correct_log_id}, synchronize_session='fetch'
846+
)
842847

843848
# Before checking if the _current_ value exists, we need to check if the old config value we upgraded in
844849
# place exists!

0 commit comments

Comments
 (0)