Skip to content

Commit

Permalink
Merge pull request #7 from timberio/vector-to-datadog
Browse files Browse the repository at this point in the history
Add demo for shipping Vector internal logs/metrics to Datadog
  • Loading branch information
lucperkins authored Sep 2, 2021
2 parents e64d402 + 3db1714 commit e47e72f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion datadog-agent/vector/vector.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ codec = "json"
timestamp_format = "rfc3339"

[sinks.datadog.healthcheck]
enabled = true
enabled = true
19 changes: 19 additions & 0 deletions datadog-observability/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Send Vector logs and metrics to Datadog

In this demo, Vector is running a simple topology in which the `generator` source emits random JSON
logs twice per second and sends those logs off to stdout via the `console` sink. But even this
simple pipeline is enough to generate internal logs and metrics for Vector (via the eponymous
sources).

To run this scenario, make sure you have the `DD_API_KEY` environment variable set to your Datadog
API key and then run:

```bash
docker compose up --detach
```

Once Vector is up and running, check out the [Logs exporer][logs] and this simple
[Metrics dashboard][metrics].

[logs]: https://app.datadoghq.com/logs?query=%40tag%3Avector_internal
[metrics]: https://app.datadoghq.com/metric/explorer?live=true&tile_size=m&exp_metric=vector.events_in_total&exp_agg=avg&exp_row_type=metric
11 changes: 11 additions & 0 deletions datadog-observability/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.9'
services:
vector:
image: timberio/vector:0.16.1-alpine
ports:
- 8686:8686
environment:
- DD_API_KEY
- LOG=info
volumes:
- ./vector:/etc/vector:ro
49 changes: 49 additions & 0 deletions datadog-observability/vector/vector.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[api]
enabled = true
address = "0.0.0.0:8686"
playground = true

[sources.generator]
type = "generator"
format = "json"
interval = 0.5

[sinks.stdout]
type = "console"
inputs = ["generator"]
target = "stdout"

[sinks.stdout.encoding]
codec = "json"

[sources.vector_logs]
type = "internal_logs"

[sources.vector_metrics]
type = "internal_metrics"

[transforms.tag_vector_logs]
type = "remap"
inputs = ["vector_logs"]
source = '''
.tag = "vector_internal"
'''

[sinks.datadog_logs]
type = "datadog_logs"
inputs = ["tag_vector_logs"]
default_api_key = "${DD_API_KEY}"

[sinks.datadog_logs.healthcheck]
enabled = true

[sinks.datadog_logs.encoding]
codec = "json"

[sinks.datadog_metrics]
type = "datadog_metrics"
inputs = ["vector_metrics"]
api_key = "${DD_API_KEY}"

[sinks.datadog_metrics.healthcheck]
enabled = true

0 comments on commit e47e72f

Please sign in to comment.