Can Kubernetes see my Angular console logs?

11/10/2020

My angular app is deployed on a Kubernetes container and the logs of the application on that container are scraped only if they are outputted as stdout or stderr. In my angular application, I am currently logging using console.log as I believe it's the same function Question I referred , want to know if this is correct or if stdout is something else?

-- FatBoy98
angular
kubernetes
logging
stdout

1 Answer

11/10/2020

Short answer: no

The Angular app runs in the users browser. That means any logs using console.log will be logged on the user side in their browser and Kubernetes will not know about it.

The part that runs in Kubernetes is actually a static web server like Nginx or perhaps a NodeJS server that is just serving up the files.

If you have a backend service (like NodeJS) the logs in the server process will show up in stdout and stderr. Those can be picked up in Kubernetes.

To get the logs from Angular you would need to send them from the client to the backend over REST or something similar.

-- Justin Tamblyn
Source: StackOverflow