在独立的flink集群中提交flink作业时,如何指定与守护程序日志文件不同的日志文件 [英] How to specify log file different from daemon log file while submitting a flink job in a standalone flink cluster
问题描述
当我启动flink独立集群时,它将守护程序日志记录在conf/log4j.properties文件中提到的文件中,而当我在该集群中提交flink作业时,它将使用相同的属性文件记录应用程序日志并写入任务管理器上的相同日志文件.我希望在该flink独立集群中提交的每个应用程序都有单独的日志文件.有什么办法可以实现
When I am starting a flink standalone cluster, It logs daemon logs in a file mentioned in conf/log4j.properties file, and when I submit a flink job in that cluster, it uses same properties file to log the application logs and write into same log file on taskmanagers. I want to have separate log files for my each application submitted in that flink standalone cluster. Is there any way to achieve that
推荐答案
使用./bin/flink Shell脚本提交作业时,请使用以下环境变量来控制日志文件的位置:
When you submit the job using the ./bin/flink shell script, use the following environment variables to control log file location:
- FLINK_LOG_DIR指定将在其中显示日志的目录
- FLINK_IDENT_STRING使您可以使文件名唯一
例如,如果您使用来开始工作
For example if you start your job with
FLINK_LOG_DIR=/var/log FLINK_IDENT_STRING=my_app_id ./bin/flink run /path/to/the.jar
然后,日志将显示在/var/log/flink-my_app_id-client-$HOSTNAME.log
then the logs will appear in /var/log/flink-my_app_id-client-$HOSTNAME.log
请注意,这仅适用于通过日志记录框架记录的消息,不适用于仅打印到stdout的内容.
Note that this only applies to the messages that are logged via the logging frameworks and not for the things that are just printed to stdout.
这篇关于在独立的flink集群中提交flink作业时,如何指定与守护程序日志文件不同的日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!