github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/commands/job/history.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: 'Commands: job history'
     4  description: |
     5    The history command is used to display all tracked versions of a job.
     6  ---
     7  
     8  # Command: job history
     9  
    10  The `job history` command is used to display the known versions of a particular
    11  job. The command can display the diff between job versions and can be useful for
    12  understanding the changes that occurred to the job as well as deciding job
    13  versions to revert to.
    14  
    15  ## Usage
    16  
    17  ```plaintext
    18  nomad job history [options] <job>
    19  ```
    20  
    21  The `job history` command requires a single argument, the job ID or an ID prefix
    22  of a job to display the history for.
    23  
    24  When ACLs are enabled, this command requires a token with the `read-job` and
    25  `list-jobs` capabilities for the job's namespace.
    26  
    27  ## General Options
    28  
    29  @include 'general_options.mdx'
    30  
    31  ## History Options
    32  
    33  - `-p`: Display the differences between each job and its predecessor.
    34  - `-full`: Display the full job definition for each version.
    35  - `-version`: Display only the history for the given version.
    36  - `-json` : Output the job versions in its JSON format.
    37  - `-t` : Format and display the job versions using a Go template.
    38  
    39  ## Examples
    40  
    41  Display the history showing differences between versions:
    42  
    43  ```shell-session
    44  $ nomad job history -p e
    45  Version     = 2
    46  Stable      = false
    47  Submit Date = 07/25/17 20:35:43 UTC
    48  Diff        =
    49  +/- Job: "example"
    50  +/- Task Group: "cache"
    51    +/- Task: "redis"
    52      +/- Resources {
    53            CPU:      "500"
    54            DiskMB:   "0"
    55        +/- MemoryMB: "256" => "512"
    56          }
    57  
    58  Version     = 1
    59  Stable      = false
    60  Submit Date = 07/25/17 20:35:31 UTC
    61  Diff        =
    62  +/- Job: "example"
    63  +/- Task Group: "cache"
    64    +/- Count: "1" => "3"
    65        Task: "redis"
    66  
    67  Version     = 0
    68  Stable      = false
    69  Submit Date = 07/25/17 20:35:28 UTC
    70  ```
    71  
    72  Display the memory ask across submitted job versions:
    73  
    74  ```shell-session
    75  $ nomad job history -t "{{range .}}\
    76  v{{.Version}}: {{with index .TaskGroups 0}}{{with index .Tasks 0}}{{.Resources.MemoryMB}}{{end}}{{end}}\
    77  
    78  {{end}}" example
    79  v2: 512
    80  v1: 256
    81  v0: 256
    82  ```