# Using commands and flags with dynctl

Use dynctl to monitor, debug, and troubleshoot a Dynamic Engine cluster and services running in it.

The dynctl commands allow you to

* Check dynctl version.
* Generate shell completion scripts.
* Retrieve cluster details.
* View logs of running services in the Dynamic Engine cluster.
* Diagnose a Dynamic Engine installation.
* Update dynctl.

## The dynctl syntax

The general syntax for dynctl commands is:

```
dynctl [command] [params] [flags]
```

In this syntax:

- command
    - Specifies the operation to perform, such as collecting logs or listing environments.
- params
    - Provides additional details required for the command, such as resource IDs.
- flags
    - Sets additional instructions, such as --kubeconfig to override the default Kubeconfig file.

Information noteImportant: Command-line flags take precedence over default values, configuration file settings, and environment variables. The order of precedence for configuration values is:

1. Command-line flags (highest priority).
2. Environment variables.
3. Configuration in YAML file (lowest priority).

## The dynctl commands

| Command | Syntax | Description |
| --- | --- | --- |
| version | dynctl version | Shows the current dynctl version. |
| completion | dynctl completion [shell] | Creates shell-specific completion scripts (Bash,<br>Zsh, PowerShell, and<br>Fish). For more details, see [Optional: Installing the dynctl auto-completion feature](https://help.qlik.com/talend/en-US/dynamic-engine-configuration-guide/Cloud/ctl-troubleshooting-for-dynamic-engine "Setting up auto-completion makes dynctl easier to use by providing real-time command suggestions."). |
| doctor | dynctl doctor [flags] | Runs automated diagnostics on the Dynamic Engine installation in the cluster and prints a health report. Exits with a<br>non-zero code when a blocker-severity check fails. Available from<br>dynctl 1.1.0. For details, see [Diagnosing an installation with dynctl doctor](https://help.qlik.com/talend/en-US/dynamic-engine-configuration-guide/Cloud/dynctl-diagnose-installation-with-doctor "Run dynctl doctor to check the cluster requirements and the health of a Dynamic Engine installation."). |
| get | dynctl get [flags] | Retrieves Dynamic Engine details from the cluster. |
| get environment | dynctl get environment &lt;name&gt;<br>[flags]<br><br>dynctl get env &lt;name&gt;<br>[flags]<br><br><ul> <li><span>name</span>: The name of the <span>Dynamic Engine</span> environment to print details of. If omitted, lists all                              environments.</li> </ul> | Lists Dynamic Engine environments or provides details about a specific environment. |
| help | dynctl help &lt;command&gt; | Gets help for a specific command. |
| logs | dynctl logs [flags] | Displays logs for running Dynamic Engine services in the cluster. |
| logs environment | dynctl logs environment &lt;name&gt;<br>[flags]<br><br>dynctl logs env &lt;name&gt;<br>[flags]<br><br><ul> <li><span>name</span>: The name of the <span>Dynamic Engine</span> environment to print details of. If omitted, lists all                              environments.</li> </ul> | Displays logs of running services for the specified Dynamic Engine environment. |
| update | dynctl update | Downloads and installs the latest released dynctl for<br>your platform, after verifying its checksum, and replaces the current<br>binary. No cluster access is required. Available from<br>dynctl 1.1.0. For details, see [Updating dynctl](https://help.qlik.com/talend/en-US/dynamic-engine-configuration-guide/Cloud/dynctl-update "Update dynctl to the latest generally available release with dynctl update."). |

## The dynctl command flags

Flags modify command behavior by overriding default settings. They fall into two categories:

1. Global flags: Apply to all commands.
2. Command-specific flags: Apply only to designated commands.

Command-line flags take precedence over default values in the configuration file and environment variables. The order of precedence for configuration values is:

1. Command-line flags as explained above (highest priority).
2. Environment variables.
3. Configuration in YAML file (lowest priority).

- **Global flags**
    - 
- --config
    - Overrides the default dynctl configuration file, $HOME/.dynctl/config.
- --kubeconfig
    - Overrides the default kubectl configuration for cluster connection.
- --kubecontext
    - Overrides the Kubernetes context that defaults to default-context in the kubeconfig file.
- -d, --debug
    - Enables debug mode, converting dynctl logs from JSON to human-readable format.
- -v, --verbose
    - Enables verbose mode, logging all dynctl log levels.
- -h, --help
    - Displays help information for the command.
- --no-update-check
    - Skips the once-a-day startup check for a newer dynctl version, which suppresses the update notice. Default: false. Applies to all commands. Available from dynctl 1.1.0.

- **Command-specific flags for logs and logs environment**
    - 
- --follow, -f
    - Continuously streams logs as they are generated. Default: false.
- --output, -o
    - Specifies log output format, either stdout or zip. Default: stdout.
- --output-file
    - Sets the path for the output file. Default: autogenerated.
- --service, -s
    - Filters logs by specified service. You can use this flag multiple times to filter for multiple services.
- --since
    - Shows log output generated within a specified duration, for example, 300ms, -1.5h, 2h45m. Valid time units are ns, us (or µs), ms, s, m, h. Default: all logs.
- --tail
    - Specifies the number of log output lines to display. Default: all lines.

- **Command-specific flags for doctor**
    - 
- --category
    - Restricts the checks to a single category: cluster-prereqs, dynamic-engine, or environments. Default: all categories.
- --severity
    - Sets the minimum severity to show: info, warning, or blocker. Default: info.
- --format
    - Sets the output format: text or json. Default: text.
- --quiet
    - Hides passing checks in the report. Default: true. Use --quiet=false to show every check.

## The dynctl configuration methods

The dynctl tool can be configured using multiple methods, listed in order of precedence:

1. Command-line flags as explained above (highest priority).
2. Environment variables.
3. Default values in YAML file (lowest priority).

Configuration method mappingConfiguration method mapping

| Flag | Environment variable | YAML key | Default | Description |
| --- | --- | --- | --- | --- |
| --config | DYNCTL\_CONFIG | config | $HOME/.dynctl/config | The dynctl configuration file path |
| --kubeconfig | DYNCTL\_KUBECONFIG | k8s.config | kubectl's default | Kubernetes configuration file(s) for dynctl |
| --kubecontext | DYNCTL\_KUBECONTEXT | k8s.context | kubectl's current context | Kubernetes context for dynctl |
| --debug | DYNCTL\_DEBUG | debug | false | Debug mode |
| --verbose | DYNCTL\_VERBOSE | verbose | false | Verbose mode |
| --no-update-check | DYNCTL\_NO\_UPDATE\_CHECK | no.update.check | false | Skips the startup check for a newer dynctl<br>version |