## zowe › zos-logs › list › logs

List z/OS operlog within a time range.

Use this operation to get the z/OS operations logs. It invokes z/OSMF REST API to retrieve logs.

Executing 'zowe zos-logs list logs' will by default return logs from current time and backwards to 10 minutes before.

Note: OPERLOG needs to be configured on z/OS server.

#### Usage

zowe zos-logs list logs [options]

#### Options

- `--start-time` | `--st` (string)

  - Specify the time in ISO-8601 time format from when z/OSMF will start to retrieve the logs. For example, '2021-01-26T03:33:18.065Z', '2021-01-26T11:33:18.065+08:00'. Default is the current time.

- `--direction` | `-d` (string)

  - Specify the direction when retrieving the message log. Either 'forward' or 'backward' is valid, case insensitive.

    Default value: backward
    Allowed values: forward, backward

- `--range` | `-r` (string)

  - Specify a time range in which the logs will be retrieved. The format is like nnnu, nnn is 1-999, u is one of 's', 'm', 'h', for example, '999s', '20m', '3h'.

    Default value: 10m

#### Zosmf Connection Options

- `--host` | `-H` (string)

  - The z/OSMF server host name.

- `--port` | `-P` (number)

  - The z/OSMF server port.

    Default value: 443

- `--user` | `-u` (string)

  - Mainframe (z/OSMF) user name, which can be the same as your TSO login.

- `--password` | `--pass` | `--pw` (string)

  - Mainframe (z/OSMF) password, which can be the same as your TSO password.

- `--reject-unauthorized` | `--ru` (boolean)

  - Reject self-signed certificates.

    Default value: true

- `--base-path` | `--bp` (string)

  - The base path for your API mediation layer instance. Specify this option to prepend the base path to all z/OSMF resources when making REST requests. Do not specify this option if you are not using an API mediation layer.

- `--protocol` (string)

  - The protocol used (HTTP or HTTPS)

    Default value: https
    Allowed values: http, https

- `--cert-file` (local file path)

  - The file path to a certificate file to use for authentication

- `--cert-key-file` (local file path)

  - The file path to a certificate key file to use for authentication

- `--completion-timeout` | `--cto` (number)

  - The amount in time, in seconds, a REST operation should wait to complete before timing out

- `--establish-connection-timeout` | `--ecto` (number)

  - The amount of time, in seconds, a REST operation should wait while connecting to the server before timing out

#### Profile Options

- `--zosmf-profile` | `--zosmf-p` (string)

  - The name of a (zosmf) profile to load for this command execution.

- `--base-profile` | `--base-p` (string)

  - The name of a (base) profile to load for this command execution.

#### Base Connection Options

- `--token-type` | `--tt` (string)

  - The type of token to get and use for the API. Omit this option to use the default token type, which is provided by 'zowe auth login'.

- `--token-value` | `--tv` (string)

  - The value of the token to pass to the API.

#### Examples

- List logs starting from '2021-07-26T03:38:37.098Z' and forwards to 5 minutes later:

  - `zowe zos-logs list logs --start-time 2021-07-26T03:38:37.098Z --range 5m --direction forward`

- List logs starting from '2021-07-26T03:38:37.098Z' and forwards to 5 minutes later. Alias version of the above command:

  - `zowe zos-logs list logs --st 2021-07-26T03:38:37.098Z -r 5m -d forward`

- List logs starting from '2021-07-26T03:38:37.098Z' and backwards to 5 minutes before:

  - `zowe zos-logs list logs --start-time 2021-07-26T03:38:37.098Z --range 5m`