# 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](https://docs.groundcover.com/use-groundcover/add-custom-environment-labels)            |
| `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](https://docs.groundcover.com/architecture/byoc/ingestion-endpoints#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](https://docs.groundcover.com/welcome/readme) 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
