I have made a small hello world api printing time on STDOUT and created the its job using raw_exec driver.
Is it possible to view the stdout of the application anywhere in the ui.
I know we can download the log file from alloc option but is there any possible way to view the live logs on console(like kubernetes). I thought they can print in monitor console but it only shows the logs of nomad agent not the one created via job applications.
Yes it’s possible to see application logs from the Nomad UI. You will need to go down to the task level inside an allocation, which is inside a job. Here’s the relevant Learn guide: Inspect Cluster Workload | Nomad - HashiCorp Learn.
Make sure you have the right output (
stdout) selected in the top left.
Hey thanks a lot. I’m able to see them now.
Is there anyway to delete these 2 files. Something like logs will show only on console and nowhere save in storage. If not, then is there anyway to delete them automatically after certain period. If that is also not possible, then is it possible that whosever is pushing the job can delete the logs manually from ui.
It is not possible to give user an access over machine where logs are generating. If they can delete from ui then responsibilities of administrator will be reduce.
Writing to console will actually write to a file so the content can be retrieved later. If you only write to
/dev/stderr you wouldn’t be able to access log history.
These files are automatically removed when the allocations stops and the Nomad’s garbage collector runs. You can fine tune when GC gets triggered by modifying the clients’
gc_* configuration values.
They are also removed when the task log rotates (notice the
.0 in the file name, this means it’s the first rotation). You can customize how often and how many rotated logs to keep using the tasks
in case you use scripts as the command, you could add an
exec 2> &1
at the top of the script to make STDERR go to STDOUT. I do that to ease debugging later.
Hey shantanu. thanks But I’m running golang based applications