|
| 1 | +--- |
| 2 | +description: Send logs to Dynatrace |
| 3 | +--- |
| 4 | + |
| 5 | +# Dynatrace |
| 6 | + |
| 7 | +Stream logs to [Dynatrace](https://www.dynatrace.com) by utilizing the **http** plugin to send data to [Dynatrace generic log ingest API](https://docs.dynatrace.com/docs/shortlink/lma-generic-log-ingestion). |
| 8 | + |
| 9 | +Before starting you need to get a [Dynatrace API](https://docs.dynatrace.com/docs/shortlink/api-authentication) token with the `logs.ingest` (Ingest Logs) scope, and determine your [environment ID](https://docs.dynatrace.com/docs/shortlink/monitoring-environment#environment-id). Then configure **http** output plugin with the following HTTP parameters. |
| 10 | + |
| 11 | +## Configuration Parameters |
| 12 | + |
| 13 | +| Key | Description | default | |
| 14 | +| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | |
| 15 | +| header | The specific header for content-type | Content-Type application/json; charset=utf-8 | |
| 16 | +| header | The specific header for authorization token, where {your-API-token-here} is the Dynatrace API token with log ingest scope | Authorization Api-Token {your-API-token-here} | |
| 17 | +| Allow_Duplicated_Headers | Specifies duplicated header use | false | |
| 18 | +| host | Your Dynatrace environment hostname where {your-environment-id} is your environment ID. | {your-environment-id}.live.dynatrace.com | |
| 19 | +| port | TCP port of your Dynatrace host | 443 | |
| 20 | +| uri | Specify the HTTP URI for Dynatrace log ingest API | /api/v2/logs/ingest | |
| 21 | +| format | The data format to be used in the HTTP request body | json | |
| 22 | +| json_date_format | Date format standard for JSON | iso8601 | |
| 23 | +| json_date_key | Fieldname specifying message timestamp | timestamp | |
| 24 | +| tls | Specify to use TLS | on | |
| 25 | +| tls.verify | TLS verification | on | |
| 26 | + |
| 27 | +## Getting Started |
| 28 | + |
| 29 | +1. Get a [Dynatrace API](https://docs.dynatrace.com/docs/shortlink/api-authentication) token with the `logs.ingest` (Ingest Logs) scope. |
| 30 | +2. Determine your Dynatrace [environment ID](https://docs.dynatrace.com/docs/shortlink/monitoring-environment#environment-id). |
| 31 | +3. In your main Fluent Bit configuration file, append the following _Output_ section: |
| 32 | + |
| 33 | +```text |
| 34 | +[OUTPUT] |
| 35 | + name http |
| 36 | + match * |
| 37 | + header Content-Type application/json; charset=utf-8 |
| 38 | + header Authorization Api-Token {your-API-token-here} |
| 39 | + allow_duplicated_headers false |
| 40 | + host {your-environment-id}.live.dynatrace.com |
| 41 | + Port 443 |
| 42 | + URI /api/v2/logs/ingest |
| 43 | + Format json |
| 44 | + json_date_format iso8601 |
| 45 | + json_date_key timestamp |
| 46 | + tls On |
| 47 | + tls.verify On |
| 48 | +``` |
| 49 | + |
| 50 | +4. Once the configuration is applied and new logs are appended, verify their receipt within Dynatrace. This can be done using Dynatrace [Notebooks](https://docs.dynatrace.com/docs/observe-and-explore/dashboards-and-notebooks/notebooks) with a Dynatrace Query Language query, for example: |
| 51 | + |
| 52 | + ``` |
| 53 | + fetch logs |
| 54 | + ``` |
| 55 | +
|
| 56 | +## References |
| 57 | +
|
| 58 | +* [Dynatrace Fluent Bit documentation](https://docs.dynatrace.com/docs/shortlink/lma-stream-logs-with-fluent-bit) |
| 59 | +* [Fluent Bit integration in Dynatrace Hub](https://www.dynatrace.com/hub/detail/fluent-bit/?filter=log-management-and-analytics) |
| 60 | +* [Video: Stream a Log File to Dynatrace using Fluent Bit](https://www.youtube.com/watch?v=JJJNxhtJ6R0) |
| 61 | +* [Blog: Easily stream logs from Fluent Bit to Dynatrace](https://www.dynatrace.com/news/blog/easily-stream-logs-with-fluent-bit-to-dynatrace/) |
0 commit comments