# Enable ECS logging

To generate logs for AWS ECS clusters, you must first create an Elasticsearch logging container. Once auditing is enabled, your container logging data can be captured for analysis.

## Prerequisites

* [Create a Task Definition](https://docs.duplocloud.com/docs/automation-platform/aws-services/containers#7-toc-title)
* Define at least one [Service and container](https://docs.duplocloud.com/docs/automation-platform/overview/aws-services/containers).
* Enable the[ Audit](https://docs.duplocloud.com/docs/automation-platform/overview/auditing#enabling-audit) feature.

## Enabling ECS ElasticSearch logging

1. In the DuploCloud Portal, navigate to **Administrator** -> **Tenant**. The **Tenant** page displays.
2. From the **Name** column, select the Tenant that is running the container for which you want to enable logging.
3. Click the **Settings** tab.
4. Click **Add**. The **Add Tenant Feature** pane displays.
5. From the **Select Feature** list box, select **Other**. The **Configuration** field displays.
6. In the **Configuration** field, enter **Enable ECS ElasticSearch Logging**.
7. In the field below the **Configuration** field, enter **True**.
8. Click **Add**. In the **Settings** tab, **Enable ECS ElasticSearch Logging** displays a **Value** of **True**.

<div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FPqy0ma6ArhpfFUvwQEQf%2Fimage.png?alt=media&#x26;token=59607855-fc8e-4a62-9796-2578116125d2" alt=""><figcaption></figcaption></figure></div>

## Verifying ECS logging is enabled

You can verify that ECS logging is enabled for a specific container.

1. In the DuploCloud Portal, navigate to **Cloud Services** -> **ECS**.
2. In the **Task Definitions** tab, select the **Task Definition Family Name** in which your container is defined.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F6Xni67xCM4ApZaMFUIqe%2Fscreenshot-nimbusweb.me-2024.02.18-12_37_06.png?alt=media&#x26;token=02589651-e881-415e-85e5-87b47c449562" alt=""><figcaption><p>The Task Definition Family Name detail page with <strong>Task Definitions</strong> tab selected</p></figcaption></figure></div>
3. Click the **Task Definitions** tab.
4. Menu icon ( <img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FxLkcUNKntyMJKGrP7Wad%2Fmenu%20icon.png?alt=media&#x26;token=c4f245e3-80f8-4573-a7c8-7d4233e7d1be" alt="" data-size="line">) in the row of the task definition and select **Edit Task Definition**. The **Edit Task Definition** page displays your defined **Container**s.

<figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FThf8iQIAGfV09OeuHNEC%2Fscreenshot-nimbusweb.me-2024.02.18-12_40_32.png?alt=media&#x26;token=466b0ac3-2116-48ba-b75d-3742369a9bbb" alt=""><figcaption><p><strong>Task Definitions</strong> tab menu with <strong>Edit Task Definitio</strong>n highlighted</p></figcaption></figure>

In the **Container - 1** area, in the **Container Other Config** field, your `LogConfiguration` is displayed.

<div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FIcHtP4WlrXy7JfHtJzSF%2FAWS_ECS_Logging_3.png?alt=media&#x26;token=a5aaf54e-c572-40ab-9011-b3b8e8a41f24" alt=""><figcaption><p><strong>Container - 1</strong> area of the Task Definition editor with highlighted <strong>Container Other Config</strong> field for <strong>container1</strong></p></figcaption></figure></div>

In the **Container-2** area, another container is created by DuploCloud with the name `log_router`.

<figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FMPG6wnkZYh9UewmRE3PT%2Fimage.png?alt=media&#x26;token=4ef9af7c-fd2b-4836-be95-9f7b66d7cacb" alt=""><figcaption><p><strong>Container - 2</strong> area of the Task Definition editor displaying configuration for <strong>log_router</strong> container, created by DuploCloud</p></figcaption></figure>


---

# 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.duplocloud.com/docs/automation-platform/overview/use-cases/creating-an-infrastructure-and-plan-for-aws/ecs-setup/enable-ecs-logging.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.
