Wednesday, February 06, 2019

Tip of Streaming Logs to Stdout for K8S Pods


 In K8S world, we need to stream apps logs output to standard output for analysis purpose. For example, we need to gather access logs information  of our applications , so we need to redirect all access logs data to stdout of Pod.


  Find full path of the logs which we would like to stream
  ie /var/log/apache2/access_log    and /var/log/apache2/error_log

Use below ln to link to stdout
ln -sf   /proc/self/fd/1  /var/log/apache2/access_log 
ln -sf  /proc/self/fd/1   /var/log/apache2/error_log

No comments: