---
schema_version: "1"
id: 1e85fa15cb0018f06188059f2a41e7c70b87f9118b748bbacec3ca043fcd88b2
title: Troubleshooting with the CLI
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.9/flex-troubleshoot-admin-api.md
canonical_url: https://docs.mulesoft.com/gateway/1.9/flex-troubleshoot-admin-api
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 2279fb9828160a8c1c33471c6ddf1061f1af48499dfd47da2857b3b7bc8d4ed2
description: MuleSoft Documentation Site
release: "1.9"
latest: false
---
---
product: Omni Gateway
version: 1.9
---

# Troubleshooting with the CLI

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Anypoint Flex Gateway includes a `flexctl dump` CLI that enables you to query for information
related to a gateway’s API instances, services, configuration, and available extensions (policies).

As an example, the following inline configuration snippet defines a single API instance named
`jsonplaceholder-api` in the default namespace (it remains `default` because namespace is not
explicitly defined.) Additionally, the snippet defines one included policy:
`http-basic-authentication-flex`.

> [!NOTE] To run `flexctl dump` for Linux deployments, either add the user to the `flex` user group
> or run `flexctl dump` with the `sudo` command. To learn more, see
> [Troubleshooting Linux Permissions](https://docs.mulesoft.com/gateway/1.9/flex-troubleshoot-linux-permissions).

## Configuration Example

apiVersion: gateway.mulesoft.com/v1alpha1 kind: ApiInstance metadata: name: jsonplaceholder-api
spec: address: http://0.0.0.0:8080 services: jsonplaceholder: address:
https://jsonplaceholder.typicode.com:443/ routes: - rules: - path: /api(/users/.\*) - path:
/api(/comments/.\*) policies: - policyRef: name: http-basic-authentication-flex config: username:
chris password: admin

## Run the CLI

1.  To see JSON representations of your API instances, services, configurations, and extensions, run
    the following command:

    ```ssh
    flexctl dump
    ```

    > [!NOTE] When running in a Docker or Podman container, run the command in the container itself.

    The command outputs four files:

    - `api-instances.json`

    - `services.json`

    - `configuration.json`

    - `extensions.json`

2.  View any of the JSON file contents by running `cat` followed by the file name:

    - Api Instances

    - Services

    - Configuration

    - Extensions

    ```ssh
    cat api-instances.json
    ```

    The `api-instances.json` file contents resemble the following:

    \[ { "address":"http://0.0.0.0:8080", "kind":"ApiInstance", "name":"jsonplaceholder-api",
    "namespace":"default", "policies":\[ { "config":{ "password":"admin", "username":"chris" },
    "extension":{ "kind":"Extension", "name":"http-basic-authentication-flex", "namespace":"default"
    }, "kind":"Policy", "name":"jsonplaceholder-api-http-basic-authentication-flex-1",
    "namespace":"default" }, { "config":{ "destinationRef":{ "kind":"Service",
    "name":"jsonplaceholder-api-jsonplaceholder", "namespace":"default" } } "extension":{
    "kind":"Extension", "name":"route", "namespace":"default" }, "kind":"Policy",
    "name":"jsonplaceholder-api-jsonplaceholder-route-1", "namespace":"default", "order":50,
    "rules":\[ { "path":"/api(/users/.\*)" }, { "path":"/api(/comments/.\*)" } \] }, { "extension":{
    "kind":"Extension", "name":"envoy.filters.http.router", "namespace":"default" },
    "kind":"Policy", "name":"envoy.filters.http.router", "namespace":"default", "order":2147483647 }
    \] } \]

    ```ssh
    cat services.json
    ```

    The `services.json` file contents resemble the following:

    \[ { "address":"https://jsonplaceholder.typicode.com:443/", "kind":"Service",
    "name":"jsonplaceholder-api-jsonplaceholder", "namespace":"default" } \]

    ```ssh
    cat configuration.json
    ```

    The `configuration.json` file contents resemble the following:

    { "internalMetrics": { "enabled": false }, "logging": {}, "platformConnection": { "anypoint": {
    "url": "https://anypoint.mulesoft.com" }, "environment": { "cluster\_id":
    "4aa281e9-1a1d-4c56-8669-2d887b2e1938", "env\_id": "ad067f80-69ee-4abb-9d05-bec98ece1e20",
    "org\_id": "1caa0b9b-4f4d-43c4-a1b6-f925a8c77baa" }, "logging": { "certificate": { "cert":
    "demo-local.pem", "key": "demo-local.key" }, "url":
    "https://logging.ingestion.us-east-1.msap.io/ingestion/api/v1/logging" }, "metering": {
    "certificate": { "cert": "demo-local.pem", "key": "demo-local.key" }, "url":
    "https://metering.ingestion.us-east-1.msap.io/ingestion/api/v1/metering" }, "mode": "offline",
    "monitoring": { "certificate": { "cert": "demo-local.pem", "key": "demo-local.key" }, "url":
    "https://monitoring.ingestion.us-east-1.msap.io/ingestion/api/v1/monitoring" }, "runtimeEvents":
    { "certificate": { "cert": "demo-local.pem", "key": "demo-local.key" }, "url":
    "https://anypoint.mulesoft.com/apiruntime/v1/events" } }, "resourceLimits": { "apiInstances":
    100, "policies": 400 }, "sharedStorage": {}, "version": "1.1.0" }

    ```ssh
    cat extensions.json
    ```

    The `extensions.json` file contains all the policies available in Flex Gateway. The file
    contents resemble the following:

    { "extends": \[ { "kind": "Extension", "labels": { "flex.mulesoft.com/created-by":
    "flex-filesystem", "flex.mulesoft.com/managed-by": "flex-filesystem" }, "name":
    "extension-definition", "namespace": "default" }, { "kind": "Extension", "labels": {
    "flex.mulesoft.com/created-by": "flex-filesystem", "flex.mulesoft.com/managed-by":
    "flex-filesystem" }, "name": "extension-qos", "namespace": "default" } \], "kind": "Extension",
    "labels": { "flex.mulesoft.com/created-by": "flex-filesystem", "flex.mulesoft.com/managed-by":
    "flex-filesystem" }, "name": "header-injection-definition", "namespace": "default",
    "properties": \[ { "name": "config", "properties": \[ { "items": { "name": "inboundHeaders",
    "properties": \[ { "name": "key", "type": "stringOrDataweave" }, { "name": "value", "type":
    "stringOrDataweave" } \], "type": "object" }, "name": "inboundHeaders", "type": "array" }, {
    "items": { "name": "outboundHeaders", "properties": \[ { "name": "key", "type":
    "stringOrDataweave" }, { "name": "value", "type": "stringOrDataweave" } \], "type": "object" },
    "name": "outboundHeaders", "type": "array" } \], "type": "object" } \] }

## Change Verbosity Level

You can change the amount of information output by the `flexctl dump` CLI. For example, to increase
verbosity to a value of `10`, run `flexctl dump` with the following:

```ssh
flexctl dump -v 10
```

## Change Output Directory

Additionally, you can change the directory where `flexctl dump` outputs the four files. For example,
to output to `/tmp`, run `flexctl dump` with the following:

```ssh
flexctl dump --output-directory /tmp
```

## See Also

- [Known Issues](https://help.salesforce.com/s/issues)
