# Fluentd

groundcover supports ingestion of logs from Fluentd collectors. This page will guide you to configure your Fluentd collector to send logs it has collected to your groundcover installation.

{% hint style="info" %}
This feature is only available for enterprise plan.
{% endhint %}

{% hint style="info" %}
We currently only supports ingesting logs from FluentD. If you would like to ingest something else, [let us know over Slack.](https://www.groundcover.com/join-slack)
{% endhint %}

## Setting metadata

While not required, it is suggested to set metadata attributes to be recognized by groundcover.

| Attribute        | Meaning                                                                                                                                                       |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `env_name`       | Will associate the log with an environment in groundcover. [Read more](/use-groundcover/add-custom-environment-labels.md)                                     |
| `clusterId`      | Will associate the log with a cluster in groundcover.                                                                                                         |
| `host.name`      | Will appear as the logs' hostname                                                                                                                             |
| `gc_source_type` | <p>will appear the source of the type of the logs. . Can be any value of your choosing.<br>For example, logs from Kubernetes clusters are marked as 'k8s'</p> |
| `service.name`   | Will appear as the name of the workload that created the log.                                                                                                 |

For example:

```xml
<filter **>
  @type record_transformer
  <record>
    host.name "#{Socket.gethostname}"
    env_name "production" # Adjust based on your environment
    clusterId "prod-1"
    gc_source_type "host"
    service.name "server-app"
  </record>
</filter>
```

## Configuring HTTP output to groundcover

We will use [Fluentd's HTTP output plugin](https://docs.fluentd.org/output/http) to send the logs to groundcover.

### Finding the endpoint of the BYOC backend

Use [these](/architecture/byoc/ingestion-endpoints.md#json-logs) docs to find your BYOC's JSON logs endpoint, and make sure you have your API key. It should look something like this: `https://<your-byoc-endpoint>/json/logs`

### Configuring an output stage

Add this output plugin to your Fluentd configuration:

```xml
<match server.logs>
  @type http
  endpoint <byoc_json_logs_endpoint>
  headers {"apikey": <ingestion_key>}
  http_method post
  <format>
    @type json
  </format>
</match>
```

You can adjust further settings like buffer as described in the plugin's documentation.

## Viewing your logs

Access the groundcover [platform](/welcome/readme.md) and you should see your logs in the log page. We recommend looking based on the attributes previously set:

* `source` can be used with the `gc_source_type`attribute
* `env` can be used with the `env_name`attribute
* `workload` can be used with the `service.name`attribute


---

# 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.groundcover.com/integrations/data-sources/fluentd.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.
