Logging issue with pod snippet

Hello All,

Just trying to log container logs to a particular file by using below sample nginx pod snippet.

Below is the snippet of code but it is failing to create. Can anyone help me out where it is failing?

apiVersion: v1
kind: Pod
metadata:
name: legacy-app
spec:
containers:

  • name: count
    image: busybox
    args: [/bin/sh, -c, ‘tail -n+1 -f /var/log/legacy-app.log’]
    volumeMounts:
    • name: varlog
      mountPath: /var/log
      volumes:
  • name: varlog
    hostPath:

    Ensure the file directory is created.

    path: /var/log
    type: DirectoryOrCreate