Re: Default Log4j properties in Native Kubernetes

2023-06-21 Thread Yang Wang
I assume you are using "*bin/flink run-application*" to submit a Flink
application to K8s cluster. Then you could simply
update your local log4j-console.properties, it will be shipped and mounted
to JobManager/TaskManager pods via ConfigMap.

Best,
Yang

Vladislav Keda  于2023年6月20日周二
22:15写道:

> Hi all again!
>
> Please tell me if you can answer my question, thanks.
>
> ---
>
> Best Regards,
> Vladislav Keda
>
> пт, 16 июн. 2023 г. в 16:12, Vladislav Keda <
> vladislav.k...@glowbyteconsulting.com>:
>
>> Hi all!
>>
>> Is it possible to change Flink* log4j-console.properties* in Native
>> Kubernetes (for example in Kubernetes Application mode) without rebuilding
>> the application docker image?
>>
>> I was trying to inject a .sh script call (in the attachment) before
>> /docker-entrypoint.sh, but this workaround did not work (k8s gives me an
>> exception that the log4j* files are write-locked because there is a
>> configmap over them).
>>
>> Is there another way to change log4j* files?
>>
>> Thank you very much in advance!
>>
>> Best Regards,
>> Vladislav Keda
>>
>


Re: Default Log4j properties in Native Kubernetes

2023-06-20 Thread Vladislav Keda
Hi all again!

Please tell me if you can answer my question, thanks.

---

Best Regards,
Vladislav Keda

пт, 16 июн. 2023 г. в 16:12, Vladislav Keda <
vladislav.k...@glowbyteconsulting.com>:

> Hi all!
>
> Is it possible to change Flink* log4j-console.properties* in Native
> Kubernetes (for example in Kubernetes Application mode) without rebuilding
> the application docker image?
>
> I was trying to inject a .sh script call (in the attachment) before
> /docker-entrypoint.sh, but this workaround did not work (k8s gives me an
> exception that the log4j* files are write-locked because there is a
> configmap over them).
>
> Is there another way to change log4j* files?
>
> Thank you very much in advance!
>
> Best Regards,
> Vladislav Keda
>


Default Log4j properties in Native Kubernetes

2023-06-16 Thread Vladislav Keda
Hi all!

Is it possible to change Flink* log4j-console.properties* in Native
Kubernetes (for example in Kubernetes Application mode) without rebuilding
the application docker image?

I was trying to inject a .sh script call (in the attachment) before
/docker-entrypoint.sh, but this workaround did not work (k8s gives me an
exception that the log4j* files are write-locked because there is a
configmap over them).

Is there another way to change log4j* files?

Thank you very much in advance!

Best Regards,
Vladislav Keda
#!/usr/bin/env bash

# shellcheck disable=SC2034
LOG4J_CLI_PROPERTIES_PATH="${FLINK_HOME}/conf/log4j-cli.properties"
# shellcheck disable=SC2034
LOG4J_CONSOLE_PROPERTIES_PATH="${FLINK_HOME}/conf/log4j-console.properties"
# shellcheck disable=SC2034
LOG4J_SESSION_PROPERTIES_PATH="${FLINK_HOME}/conf/log4j-session.properties"
# shellcheck disable=SC2034
LOG4J_PROPERTIES_PATH="${FLINK_HOME}/conf/log4j.properties"

override_properties() {
  local properties_var=$1
  local properties_path_var="${properties_var}_PATH"

  local content="${!properties_var}"
  local path="${!properties_path_var}"

  if [ -n "${content}" ]; then
echo "$0: ${properties_var} env variable is set. Overwriting ${path}"
echo "${content}" > "${path}"
  else
echo "$0: ${properties_var} env variable is not set. Using Flink's ${path}"
  fi
}

override_properties "LOG4J_CLI_PROPERTIES"
override_properties "LOG4J_CONSOLE_PROPERTIES"
override_properties "LOG4J_SESSION_PROPERTIES"
override_properties "LOG4J_PROPERTIES"