when i give
kubectl logs <pod-name>
it give logs of the pod whose level is set to info
how can i change this log level(both before Deployment and after deployment)?
I hope you specify the LOG_LEVEL
( i am referring LOG_LEVEL
as environment variable that will be later used by the application) in the application manifest (xyz.yaml). So when a pod is deployed it uses the LOG_LEVEL
specified in manifest and configures the application to generate logs of the specified level.
Once the pod is launched you cannot change the log level unless you delete it first and redeploy the pod using the updated manifest.
WORKAROUND
Instead of passing the LOG_LEVEL
via environment variable you can you some external tool like zookeeper for the configuration management of your application. For this approach, you need to program your application in a way that whenever a change is detected on a zookeeper node it should restart itself. I hope it makes sense, if you need help for this approach then let me know.
Ay,
As what I know you can't. Your containerized application write logs to stdout and/or stderr. These are then catched by Kubernetes.
It's the application responsibility to produce logs with info, error, etc... informations and format them to allow them being usable by an external logs tools like StackDriver (it's an example because I'm on GKE from Google).
So maybe when you launch your containerized application you can configure logs level to output other logs than info ?