You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/08/05 17:42:25 UTC

[GitHub] [airflow] bellhea opened a new issue #10188: task_log_prefix_template configuration is not documented and doesn't work

bellhea opened a new issue #10188:
URL: https://github.com/apache/airflow/issues/10188


   <!--
   
   Welcome to Apache Airflow!  For a smooth issue process, try to answer the following questions.
   Don't worry if they're not all applicable; just try to include what you can :-)
   
   If you need to include code snippets or logs, please put them in fenced code
   blocks.  If they're super-long, please use the details tag like
   <details><summary>super-long log</summary> lots of stuff </details>
   
   Please delete these comment blocks before submitting the issue.
   
   -->
   
   <!--
   
   IMPORTANT!!!
   
   PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE
   NEXT TO "SUBMIT NEW ISSUE" BUTTON!!!
   
   PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!
   
   Please complete the next sections or the issue will be closed.
   This questions are the first thing we need to know to understand the context.
   
   -->
   
   **Apache Airflow version**: 1.10.11
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`): 1.10.0
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**:
   - **OS** (e.g. from /etc/os-release): rhel 7.7
   - **Kernel** (e.g. `uname -a`):
   - **Install tools**:
   - **Others**:
   
   **What happened**:
   I am trying to use the configuration setting: [task_log_prefix_template](https://github.com/apache/airflow/blob/master/airflow/config_templates/default_airflow.cfg#L276)
   Firstly, I don't see it in the documented list of [configurations](https://airflow.apache.org/docs/stable/configurations-ref.html), even though it's in the source code as you can see.
   I am setting it as an environment variable like so: `AIRFLOW__CORE__TASK_LOG_PREFIX_TEMPLATE: {{ task_instance_key_str }} `
   However, it's not being picked up and the task logs don't have the prefix I've specified.
   <!-- (please include exact error messages if you can) -->
   
   **What you expected to happen**:
   The logs to be outputted with the prefix specified in the environment variable, in this instance the `task_instance_key_str` macro.
   <!-- What do you think went wrong? -->
   
   **How to reproduce it**:
   Simply attempt to set the environment variable described above and view the logs.
   <!---
   
   As minimally and precisely as possible. Keep in mind we do not have access to your cluster or dags.
   
   If you are using kubernetes, please attempt to recreate the issue using minikube or kind.
   
   ## Install minikube/kind
   
   - Minikube https://minikube.sigs.k8s.io/docs/start/
   - Kind https://kind.sigs.k8s.io/docs/user/quick-start/
   
   If this is a UI bug, please provide a screenshot of the bug or a link to a youtube video of the bug in action
   
   You can include images using the .md sytle of
   ![alt text](http://url/to/img.png)
   
   To record a screencast, mac users can use QuickTime and then create an unlisted youtube video with the resulting .mov file.
   
   --->
   
   
   **Anything else we need to know**:
   
   <!--
   
   How often does this problem occur? Once? Every time etc?
   
   Any relevant logs to include? Put them here in side a detail tag:
   <details><summary>x.log</summary> lots of stuff </details>
   
   -->
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on issue #10188: task_log_prefix_template configuration is not documented and doesn't work

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #10188:
URL: https://github.com/apache/airflow/issues/10188#issuecomment-669332352


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [airflow] potiuk closed issue #10188: task_log_prefix_template configuration is not documented and doesn't work

Posted by GitBox <gi...@apache.org>.
potiuk closed issue #10188:
URL: https://github.com/apache/airflow/issues/10188


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on issue #10188: task_log_prefix_template configuration is not documented and doesn't work

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #10188:
URL: https://github.com/apache/airflow/issues/10188#issuecomment-669346933


   This configuration option is only available in the development version from the master branch. Here is the documentation for this option.
   You pasted the link to the documentation for the stable version (currently: 1.10.11).
   https://airflow.readthedocs.io/en/latest/configurations-ref.html#task-log-prefix-template
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [airflow] bellhea commented on issue #10188: task_log_prefix_template configuration is not documented and doesn't work

Posted by GitBox <gi...@apache.org>.
bellhea commented on issue #10188:
URL: https://github.com/apache/airflow/issues/10188#issuecomment-669908236


   Right ok, thanks for that. 
   So instead I'm trying to use a custom logging config and implement something similar, would appreciate some guidance.. I have implemented the below custom "task_instance" formatter. I thought I should be able to see the actual dag and task ids in the log by using the relevant macros, but I'm just seeing the string "{{ti.dag_id}}-{{ti.task_id}}" itself. Any ideas?
   ```
   LOGGING_CONFIG = {
       'version': 1,
       'disable_existing_loggers': False,
       'formatters': {
           'airflow': {
               'format': LOG_FORMAT
           },
           'task_instance': {
               'format': "{{ti.dag_id}}-{{ti.task_id}} " + LOG_FORMAT
           },
           'airflow_coloured': {
               'format': COLORED_LOG_FORMAT if COLORED_LOG else LOG_FORMAT,
               FORMATTER_CLASS_KEY: COLORED_FORMATTER_CLASS if COLORED_LOG else 'logging.Formatter'
           },
       },
       'handlers': {
           'console': {
               'class': 'logging.StreamHandler',
               'formatter': 'airflow',
               'stream': 'ext://sys.stdout'
           },
           'task': {
               'class': 'airflow.utils.log.file_task_handler.FileTaskHandler',
               'formatter': 'task_instance',
               'base_log_folder': os.path.expanduser(BASE_LOG_FOLDER),
               'filename_template': FILENAME_TEMPLATE,
           },
   ...
   ```


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [airflow] bellhea removed a comment on issue #10188: task_log_prefix_template configuration is not documented and doesn't work

Posted by GitBox <gi...@apache.org>.
bellhea removed a comment on issue #10188:
URL: https://github.com/apache/airflow/issues/10188#issuecomment-669908236


   Right ok, thanks for that. 
   So instead I'm trying to use a custom logging config and implement something similar, would appreciate some guidance.. I have implemented the below custom "task_instance" formatter. I thought I should be able to see the actual dag and task ids in the log by using the relevant macros, but I'm just seeing the string "{{ti.dag_id}}-{{ti.task_id}}" itself. Any ideas?
   ```
   LOGGING_CONFIG = {
       'version': 1,
       'disable_existing_loggers': False,
       'formatters': {
           'airflow': {
               'format': LOG_FORMAT
           },
           'task_instance': {
               'format': "{{ti.dag_id}}-{{ti.task_id}} " + LOG_FORMAT
           },
           'airflow_coloured': {
               'format': COLORED_LOG_FORMAT if COLORED_LOG else LOG_FORMAT,
               FORMATTER_CLASS_KEY: COLORED_FORMATTER_CLASS if COLORED_LOG else 'logging.Formatter'
           },
       },
       'handlers': {
           'console': {
               'class': 'logging.StreamHandler',
               'formatter': 'airflow',
               'stream': 'ext://sys.stdout'
           },
           'task': {
               'class': 'airflow.utils.log.file_task_handler.FileTaskHandler',
               'formatter': 'task_instance',
               'base_log_folder': os.path.expanduser(BASE_LOG_FOLDER),
               'filename_template': FILENAME_TEMPLATE,
           },
   ...
   ```


----------------------------------------------------------------
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:
users@infra.apache.org