# How to configure Data Stream main settings

import Tabs from '~/components/tabs/Tabs'
import JourneyAPI from '~/includes/snippets/JourneyAPI/en/snippet.mdx'


By accessing Data Stream through [Azion Console](https://console.azion.com/data-stream) or [Azion API](https://api.azion.com/#04257075-3691-4b5f-b22b-22a5b6653f3f), you can perform a variety of actions to manage your data flows, including [create a new data streams](/en/documentation/products/guides/use-data-stream/), connect them to [endpoints](/en/documentation/products/guides/#observe), [edit data streams settings](/en/documentation/products/guides/use-data-stream/), [view detailed information](/en/documentation/products/observe/troubleshoot/data-stream-understand-metrics/) about each stream and [delete or stop data streams](/en/documentation/products/guides/observe/delete-data-stream/) that are no longer needed.

To find more detailed information on the product and each configuration, see the [reference documentation](/en/documentation/products/observe/data-stream/).

:::note
All `key` fields will be masked and an icon that allows revealing the field content will be only displayed to users with the `Edit Data Stream` permission. Users without the `Edit Data Stream` permission can only view the settings of the existing stream but not edit or create new ones.
:::

---

<Tabs client:visible>
    <Fragment slot="tab.console">Console</Fragment>
    <Fragment slot="tab.api">API</Fragment>

<Fragment slot="panel.console">

In this section, you’ll modify the main settings of your stream: name, data source, template, domains, and destination via [Azion Console](https://console.azion.com).

1. [Access Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Data Stream**.
2. From the list, select the stream you want to edit or click the **+ Stream** button.
3. Give your stream a unique and easy-to-remember name.
4. On the **Source** dropdown menu, select the one you want to use: **Activity History**, **Applications**, **Functions**, or **WAF Events**.
    - For **Functions** and **WAF Events**, you must be [subscribed to the products](/en/documentation/products/observe/data-stream/first-steps/).
5. On the **Template** dropdown menu, select the one you want to use.
    - You can modify the presented JSON in the **Data Set** code box, adding the variables you want to use in your logs' analysis. See more on [How to create a custom template on Data Stream](/en/documentation/products/guides/data-stream-custom-template/).
6. On **Workloads** > **Options**, select between ****All Curent and Future Domains** or **Filter Domains**.
    - See more about each option on [How to associate domains on Data Stream](/en/documentation/products/guides/data-stream-associate-domains/).
7. Under **Destination**, select a **Connector** on the dropdown menu: **Standard HTTP/HTTPS POST**, **Apache Kafka**, **Simples Storage Service (S3)**, **Google BigQuery**, **Elasticsearch**, **Splunk**, **AWS Kinesis Data Firehose**, **Datadog**, **IBM QRadar**, **Azure Monitor**, or **Azure Blob Storage**.
    - You'll see different fields depending on the endpoint type you choose. Find more information on each of them on the [Setting an endpoint page](/en/documentation/products/observe/data-stream/#endpoints).
8. Click the **Save** button.

</Fragment>

<Fragment slot="panel.api">

For this section, you'll be modifying an existing stream with an Elasticsearch connector via API. To create a new one, use the [Data Stream POST method](https://api.azion.com/#04257075-3691-4b5f-b22b-22a5b6653f3f).

Check the [Data Stream Properties](https://api.azion.com/#04257075-3691-4b5f-b22b-22a5b6653f3f) table to see all available properties and their accepted values.

1. Run the following `GET` request in your terminal, replacing `[TOKEN VALUE]` with your [personal token](/en/documentation/products/guides/personal-tokens/) to retrieve your `<data_streaming_id>`:

```bash
curl --request GET \
  --url https://api.azion.com/v4/data_stream/streams \
  --header 'Accept: application/json' \
  --header 'Authorization: [TOKEN VALUE]'
```

2. You'll receive a response with all your existing streams. Copy the value of the `<id>` that you want to configure.
3. Run a `PATCH` request to modify the stream as follows:

```bash
curl --request PATCH \
  --url https://api.azion.com/v4/data_stream/streams/id \
  --header 'Accept: application/json' \
  --header 'Authorization: [TOKEN VALUE]' \
  --header 'Content-Type: application/json' \
--data '{
	"name": "My Elasticsearch connector",
    "template_id": 2,
    "domain_ids": [1656613172],
    "data_source": "http",
    "endpoint": {
        "endpoint_type": "elasticsearch",
        "url": "http://elasticsearch-domain.com",
        "api_key": "VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw"
    },
    "all_domains": false
}'
```

| Key | Description |
| --- | --- |
| `name` | Name of the stream |
| `template_id` | Identifier for the template being used |
| `domain_ids` | Array value of the domain's identifiers (integers) you want to associate with the stream |
| `data_source` | Data source from which you want to stream your data |
| `endpoint` | Endpoint to which you want to stream your data |
| `all_domains` | Used to associate all current and future domains in your account to the stream |

4. You'll receive a response similar to this:

```json
{
  "results": {
    "id": 1560,
    "name": "My Elasticsearch connector",
    "template_id": 2,
    "data_source": "http",
    "active": true,
    "endpoint": {
      "endpoint_type": "elasticsearch",
      "url": "http://elasticsearch-domain.com",
      "api_key": "VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw"
    },
    "all_domains": false
  },
  "schema_version": 3
}
```

Wait a few minutes for the changes to propagate and your stream will be updated.

    <JourneyAPI />

</Fragment>

</Tabs>

<br /><br />