# Logging example

This is an example TF stack demonstrating the principles described in this RFC.

## Usage

### Setup

You will need to create the stack and populate the ECR repositories.

```
# Create the stack
terraform apply
```

### View logs

When running successfully you will see logs flowing into the `fluent-bit` index at [logging.wellcomecollection.org](https://logging.wellcomecollection.org/).

## Features

This repo demonstrates using the Fluent Bit Elasticsearch output plugin to log to our an existing ES Cluster.

It is necessary to build a custom version of the AWS Fluent Bit image to install our config (see the [fluentbit Dockerfile](https://github.com/wellcomecollection/docs/blob/main/rfcs/022-logging/example/fluentbit/Dockerfile/README.md)).

We makes use of the modify filter plugin to append environment variable tags to logs exported (to annotate service, image etc).

ES credentials for Fluent Bit are loaded from secrets manager.


---

# 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.wellcomecollection.org/request-for-comments-rfcs/022-logging/example.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.
