Posting this almost as a “note to self”, so I’ll keep it short.

Here’s how to pretty print pino logs if you’re using stern to view them from a Node.js Pod running on Kubernetes or OpenShift:

stern $POD_SELECTOR -o raw | npx pino-pretty -t

I use npx pino-pretty, but running npm install -g pino-pretty will allow you to do the following:

# Install pino-pretty globally
npm install -g pino-pretty

# Use it to view the logs
stern $POD_SELECTOR -o raw | pino-pretty -t