skip to content
Alvin Lucillo

Colored and searchable kubectl logs

/ 1 min read

💻 Tech

Just looking at kubectl logs can be painful. One way is to colorize it and make it searchable (i.e., you can search for text).

  1. Install ccze: https://github.com/cornet/ccze
  2. Query your logs (with or without timestamps), pipe the result to ccze to highlight the log and to use ANSI color sequences (i.e., the -A arg), then pipe it to less so you can query to the logs (i.e., /somekey) or navigate to them (i.e., k for up). See example below.
kubectl logs some-pod-name  --timestamps | ccze -A | less