github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/commands/job/history.mdx (about)

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