Output for Nomad Health Checks (Logs for Scripts)

We are using check in service stanza, with command, for a Docker-based task at described in https://www.nomadproject.io/docs/job-specification/service

The documents however do not detail where is the output of the script written? It is not in the logs produced by the container (i.e., in the logs UI of the task or command line nomad alloc logs ) or in the journal on the host (i.e., viewed as journalctl --since “1 hour ago” -u nomad --no-pager)

We are running Nomad 0.11.2 with following check stanza

check {
      type     = "script"
      name     = "check_test"
      command  = "/bin/bash"
      args     = ["/home/myuser/opluso/check-test.sh"]
      interval = "30s"
      timeout  = "30s"

    }

I have confirmed that the script check-test.sh does run every 30s (by putting code to send an email inside the script) but if I put echo statement in the script, the output is not visible anywhere

#!/bin/bash
echo "[`date`] Test print from check-test.sh ++++++++++++++++"

Any help on finding these logs will be super helpful for troubleshooting.

Can you check

nomad alloc logs <alloc-id>

Thanks for the reply, but I don’t see the logs from check script in the logs printed from

nomad alloc logs <alloc-id>

The above command only provides logs printed by the main task but not the shell script in the check. I updated the description for the same as well.

If you’re using Consul healthchecks you can see the output in Consul.