# Generating A Support Bundle

The Support Bundle feature allows you to generate a compressed tarball containing relevant data (logs, configs, and metric data) for troubleshooting or analysis. These bundled files can then be sent to the ElastiFlow support team to help diagnose issues with the collector. To use the Support Bundle command line tool, run the `flowcoll` command with the `--support-bundle` or `-s` flag. When the command runs successfully, it will produce a compressed tarball named similarly to `ef_support_bundle-20230831T164759.tar.gz`.

**Basic Example:**

```shell
/usr/share/elastiflow/bin/flowcoll -s
```

{% hint style="info" %}
This command will need to run within a directory where the user has write permissions, in order to create the bundle.
{% endhint %}

**Advanced Example:**

```shell
usr/share/elastiflow/bin/flowcoll -s -sc /my/config/dir -sl /my/log/dir -st 3 -si 3000
```

### Command Line Options

If an option is not specified, its specified default value will be used.

| Option                              | Shorthand | Default Value                  | Description                                                          |
| ----------------------------------- | --------- | ------------------------------ | -------------------------------------------------------------------- |
| `--support-bundle`                  | `-s`      | `false`                        | Enables support bundle mode.                                         |
| `--support-bundle-config-dir`       | `-sc`     | `/etc/elastiflow/flowcoll`     | The path to the collector's configuration directory.                 |
| `--support-bundle-logs-dir`         | `-sl`     | `/var/log/elastiflow/flowcoll` | The path to the collector's log directory.                           |
| `--support-bundle-metrics-interval` | `-si`     | `1000`                         | The interval, in milliseconds, at which metrics should be collected. |
| `--support-bundle-metrics-times`    | `-st`     | `1`                            | The number of times metrics should be collected.                     |
| `--support-bundle-output`           | `-so`     | `<Working directory>`          | The path to which the output file should be written.                 |

{% hint style="info" %}
By adjusting the collection interval (\`-si\`) and times (\`st\`), tracking and spotting trends in metrics over time can be easier.
{% endhint %}

### Generate Support Bundle By Endpoint

#### HTTP Method

POST

#### URL

`/support-bundle`

#### Request Body

All fields in the request body are optional. Defaults will be used if not specified.

* **logDirPath** (string): Directory path of the log files. Default: `/var/log/elastiflow/flowcoll`.
* **configDirPath** (string): Directory path of the configuration file. Default: `/etc/elastiflow`.

#### Query Parameters

* **interval** (integer): Interval at which the metrics will be fetched in milliseconds. Default: `1000`.
* **times** (integer): The number of times the metrics endpoint will be fetched. Default: `1`.

{% hint style="info" %}
By adjusting the collection interval (\`-si\`) and times (\`st\`), tracking and spotting trends in metrics over time can be easier.
{% endhint %}

#### Authentication

This endpoint supports Basic Authentication **only** if the collector is specifically configured for it. For configuration details, see the [API reference](broken://pages/CAPeYje8Crzcu1DCKGpO).

### Examples

#### Basic Example

Using the defaults, this example demonstrates a basic example without any query parameters or request body.

```bash
curl -X POST http://localhost:8080/support-bundle -H "Content-Type: application/json" -d '{}' -O -J --insecure
```

#### Advanced Example

This example demonstrates an advanced curl request with a filled request body and query parameters.

```bash
curl -X POST -H "Content-Type: application/json" -d '{"logDirPath":"/var/log/elastiflow/flowcoll/","configDirPath":"/etc/elastiflow/"}' -O -J "http://localhost:8080/support-bundle?interval=2000&times=2"
```

#### Responses

| Code | Reason                | Description                                                                                                                                                                                                                             |
| ---- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | OK                    | Successful response will return the support bundle file for download. The file will have a naming convention `ef_support_bundle-YYYYMMDDTHHmmss.tar.gz`, where `YYYYMMDDTHHmmss` is a timestamp indicating when the bundle was created. |
| 400  | Bad Request           | Query parameters are invalid.                                                                                                                                                                                                           |
| 500  | Internal Server Error | An internal server error occurred while processing the request.                                                                                                                                                                         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.elastiflow.com/additional-resources-reference-articles/guides/support_bundler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
