Periodic Stanza logs

Hello. I have failed periodic job. How can I find all logs for periodic jobs?
If I run
nomad status jobname

username@host1:~$ nomad status jobname
ID                   = jobname
Name                 = jobname
Submit Date          = 2022-10-11T11:53:20+03:00
Type                 = batch
Priority             = 50
Datacenters          = DC
Namespace            = default
Status               = running
Periodic             = true
Parameterized        = false
Next Periodic Launch = 2022-11-29T02:30:00Z (16h58m38s from now)

Children Job Summary
Pending  Running  Dead
0        0        50

How can I get all logs from the last and previous jobs?
Thank you!

1 Like

Hi @yyovchev,

When periodic job have been triggered and not yet garbage collected, the child job executions should be found under a heading named “Previously Launched Jobs” on the CLI when detailing the parent job.

nomad status example                                                                                                                                                                                      ✔  08:14:08
ID                   = example
Name                 = example
Submit Date          = 2022-11-30T08:13:59Z
Type                 = batch
Priority             = 50
Datacenters          = dc1
Namespace            = default
Status               = running
Periodic             = true
Parameterized        = false
Next Periodic Launch = 2022-11-30T08:15:00Z (47s from now)

Children Job Summary
Pending  Running  Dead
0        1        0

Previously Launched Jobs
ID                           Status
example/periodic-1669796040  running

If this section is missing or does not contain any job listings, it is most likely because the child job data has been garbage collected. Nomad periodically cleans its internal state of job, allocation, evaluation, and node data to keep the server memory footprint as small as possible.

In order to store and view logs for Nomad jobs, log shipping is expected. This is where the logs are taken from the Nomad client and exported to a storage source such as Loki. There are some Discuss posts which talk about this topic; the nomad-autoscaler horizontal scaling demo also includes example log shipping to Loki that could be used as reference.

Thanks,
jrasell and the Nomad team