Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ddsource for datadog #42

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ Set the secrets below associated with your desired log destination

### Datadog

| Secret | Description |
| ----------------- | --------------------------------------------- |
| `DATADOG_API_KEY` | API key for your Datadog account |
| `DATADOG_SITE` | (optional) The Datadog site. ie: datadoghq.eu |
| Secret | Description |
| ----------------- | ----------------------------------------------------- |
| `DATADOG_API_KEY` | API key for your Datadog account |
| `DATADOG_SITE` | (optional) The Datadog site. ie: datadoghq.eu |
| `DATADOG_SOURCE` | (optional) Sets the `ddsource` field on each log line |

### Honeycomb

Expand Down
15 changes: 12 additions & 3 deletions vector-configs/sinks/datadog.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
[transforms.datadog_remap]
type = "remap"
inputs = ["log_json"]
source = '''
ddsource, err = get_env_var("DATADOG_SOURCE")
if err != null {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if err != null {
if err == null {

.ddsource = ddsource
}
'''

[sinks.datadog]
# General
type = "datadog_logs" # required
inputs = ["log_json"] # required
inputs = ["datadog_remap"] # required
api_key = "${DATADOG_API_KEY}" # required
site = "${DATADOG_SITE:-datadoghq.com}" # optional
compression = "gzip" # optional, default

# Healthcheck
healthcheck.enabled = true # optional, default

healthcheck.enabled = true # optional, default