I'm trying to debug why my application logs aren't being picked up by Promtail for ingestion into Loki.
In order to exclude the complexities of my PHP application logging being the culprit, I'm simply trying to print a message to the stderr
stream from the pod's shell to be picked up by kubectl logs counter
. In order to reduce the complexity further I've spun up a brand new pod using the php:fpm-alpine
image using the below config:
apiVersion: v1
kind: Pod
metadata:
name: counter
spec:
containers:
- name: count
image: php:fpm-alpine
Once the pod is ready, I access the shell by running kubectl exec -it counter -- /bin/ash
and then run i=0; while true; do echo "$i: $(date)"; i=$((i+1)); sleep 1; done
. I can see the following output in the shell of the pod:
0: Sun May 24 13:51:09 UTC 2020
1: Sun May 24 13:51:10 UTC 2020
2: Sun May 24 13:51:11 UTC 2020
3: Sun May 24 13:51:12 UTC 2020
4: Sun May 24 13:51:13 UTC 2020
etc...
However when I run kubectl logs counter
the data returned is:
[24-May-2020 13:36:20] NOTICE: fpm is running, pid 1
[24-May-2020 13:36:20] NOTICE: ready to handle connections
I can't seem to get the output of the i=0; while true; do echo "$i: $(date)"; i=$((i+1)); sleep 1; done
command to show in the pod logs.