github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/commands/monitor.mdx (about) 1 --- 2 layout: docs 3 page_title: 'Commands: monitor' 4 sidebar_title: monitor 5 description: | 6 Stream the logs of a running nomad agent. 7 --- 8 9 # Command: monitor 10 11 The `nomad monitor` command streams log messages for a given agent. 12 13 ## Usage 14 15 ```plaintext 16 nomad monitor [options] 17 ``` 18 19 The nomad monitor command can be used to stream the logs of a 20 running Nomad agent. Monitor will follow logs and exit when 21 interrupted or until the remote agent quits. 22 23 The power of the monitor command is that it allows you to log 24 the agent at a relatively high log level (such as "warn"), 25 but still access debug logs and watch the debug logs if necessary. 26 The monitor command also allows you to specify a single client node id to follow. 27 28 When ACLs are enabled, this command requires a token with the `agent:read` 29 capability. 30 31 ## General Options 32 33 @include 'general_options_no_namespace.mdx' 34 35 ## Monitor Options 36 37 - `-log-level`: The log level to use for log streaming. Defaults to `info`. 38 Possible values include `trace`, `debug`, `info`, `warn`, `error` 39 40 - `-node-id`: Specifies the client node-id to stream logs from. If no 41 node-id is given the nomad server from the -address flag will be used. 42 43 - `-server-id`: Specifies the nomad server id to stream logs from. Accepts 44 server names from `nomad server members` and also a special `leader` option 45 which will target the current leader. 46 47 - `-json`: Stream logs in json format 48 49 ## Examples 50 51 ```shell-session 52 $ nomad monitor -log-level=DEBUG -node-id=a57b2adb-1a30-2dda-8df0-25abb0881952 53 2019-11-04T12:22:08.528-0500 [DEBUG] http: request complete: method=GET path=/v1/agent/health?type=server duration=1.445739ms 54 2019-11-04T12:22:09.892-0500 [DEBUG] nomad: memberlist: Stream connection from=127.0.0.1:53628 55 56 $ nomad monitor -log-level=DEBUG -json=true 57 {"@level":"debug","@message":"request complete"...} 58 59 ```