在独立的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 允许您使文件名唯一
例如,如果您开始工作
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
请注意,这仅适用于通过日志记录框架记录的消息,而不适用于仅打印到标准输出的内容.
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屋!