larryzhu2018 commented on a change in pull request #7141: [AIRFLOW-6544] add
log_id to end-of-file mark and also add an index config for logs
URL: https://github.com/apache/airflow/pull/7141#discussion_r368105431
##########
File path: tests/utils/log/test_es_task_handler.py
##########
@@ -262,21 +277,55 @@ def
test_set_context_w_json_format_and_write_stdout(self):
self.es_task_handler.json_format = True
self.es_task_handler.set_context(self.ti)
- def test_close(self):
- formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s
- %(message)s')
- self.es_task_handler.formatter = formatter
+ def test_close_with_log_id(self):
+ es_task_handler = ElasticsearchTaskHandler(
+ self.local_log_location,
+ self.filename_template,
+ self.log_id_template,
+ self.end_of_log_mark,
+ self.write_stdout,
+ True, # json_format
Review comment:
when you work with elastic search, json formatter is the way to go. We do
not have grok filter in the unit tests to parse and index this non-json format
message and then index them and look up as I do in the test case here.
Realistically we should probably remove the non-json format option, and it is
not practical to deploy it correctly as far as I can tell.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services