Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dynatrace-oss/fluent-plugin-dynatrace

A fluentd output plugin for sending logs to the Dynatrace Generic log ingest API v2.
https://github.com/dynatrace-oss/fluent-plugin-dynatrace

dynatrace fluent fluentd fluentd-plugin logging logs

Last synced: about 2 months ago
JSON representation

A fluentd output plugin for sending logs to the Dynatrace Generic log ingest API v2.

Awesome Lists containing this project

README

        

# fluent-plugin-dynatrace, a plugin for [fluentd](https://www.fluentd.org/)

> This project is developed, maintained and supported by Dynatrace.

A fluentd output plugin for sending logs to the Dynatrace [Generic log ingest API v2](https://docs.dynatrace.com/docs/shortlink/log-monitoring-log-data-ingestion).
For more information, see [the Dynatrace documentation on streaming logs with Fluentd](https://docs.dynatrace.com/docs/shortlink/log-monitoring-stream-logs-with-fluentd).

## Requirements

- An instance of fluentd >= v1.0 from which logs should be exported
- Ruby version >= 2.7.0
- An ActiveGate with the Generic log ingest API v2 enabled as described in the [Dynatrace documentation](https://docs.dynatrace.com/docs/shortlink/log-monitoring-log-data-ingestion)
- A [Dynatrace API token](https://docs.dynatrace.com/docs/shortlink/api-authentication) with the `logs.ingest` (Ingest Logs) scope

## Installation

The plugin is published on Rubygems at .

To install it, run the following command:

```sh
fluent-gem install fluent-plugin-dynatrace
```

If you are using `td-agent`, run:

```sh
td-agent-gem install fluent-plugin-dynatrace
```

## Configuration options

Below is an example configuration which sends all logs with tags starting with `dt` to Dynatrace.

```

@type dynatrace
active_gate_url https://{your-environment-activegate}:8021/e/{your-tenant}/api/v2/logs/ingest
api_token api_token
ssl_verify_none false
inject_timestamp false

```

If configured with custom `` settings, it is recommended to set `flush_thread_count` to `1`.
The output plugin is limited to a single outgoing connection to Dynatrace and multiple export threads will have limited impact on export latency.

### match directive

- `required`

The `match` directive is required to use an output plugin and tells fluentd which tags should be sent to the output plugin. In the above example, any tag that starts with `dt.` will be sent to Dynatrace. For more information see [how do match patterns work?](https://docs.fluentd.org/configuration/config-file#how-do-the-match-patterns-work).

### @type

- `required`

The `@type` directive tells fluentd which plugin should be used for the corresponding match block. This should always be `dynatrace` when you want to use the Dynatrace output plugin.

### `active_gate_url`

- `required`

This is the full URL of the [Generic log ingest API v2](https://docs.dynatrace.com/docs/shortlink/log-monitoring-log-data-ingestion) endpoint on your ActiveGate.

### `api_token`

- `required`

This is the [Dynatrace API token](https://docs.dynatrace.com/docs/shortlink/api-authentication) which will be used to authenticate log ingest requests. It should be assigned only the `logs.ingest` (Ingest Logs) scope.

### `ssl_verify_none`

- `optional`
- `default: false`

It is recommended to leave this optional configuration set to `false` unless absolutely required. Setting `ssl_verify_none` to `true` causes the output plugin to skip certificate verification when sending log ingest requests to SSL and TLS protected HTTPS endpoints. This option may be required if you are using a self-signed certificate, an expired certificate, or a certificate which was generated for a different domain than the one in use.

### `inject_timestamp`

- `optional`
- `default: false`

If set to true, the timestamp of the log message will be injected into the body of the message in a format readable by Dynatrace.

## Example

An full example demonstrating how to set up Fluentd on Kubernetes and export logs to Dynatrace can be found in the [example folder](./example).

## Development

`fluent-plugin-dynatrace` supports Ruby versions `>= 2.7.0` but it is recommended that at least `2.7.2` is used for development. Ruby versions can be managed with tools like [chruby](https://github.com/postmodern/chruby) or [rbenv](https://github.com/rbenv/rbenv).

### Install Dependencies

```sh
bundle install
```

### Run All Tests

```sh
rake test
```

### Run Specific Tests

```sh
# Run one test file
rake test TEST=test/plugin/out_dynatrace_test.rb
```

### Code Style Checks

```sh
# Check for code style violations
rake rubocop

# Fix auto-fixable style violations
rake rubocop:auto_correct
```

### Run all checks and build

```sh
# Runs rubocop, tests, and builds the gem
rake check
```