Skip to content

[AGNTLOG-182] feat: add site config option#86

Open
gh123man wants to merge 7 commits into
masterfrom
claude/AGNTLOG-182-add-site-config
Open

[AGNTLOG-182] feat: add site config option#86
gh123man wants to merge 7 commits into
masterfrom
claude/AGNTLOG-182-add-site-config

Conversation

@gh123man

Copy link
Copy Markdown
Member

Summary

Adds a site configuration parameter to the Fluentd Datadog output plugin so users can pick a Datadog site without needing to override host manually. This brings the plugin in line with other Datadog forwarding libraries.

JIRA: https://datadoghq.atlassian.net/browse/AGNTLOG-182

Changes

  • New config_param :site, :string, default: "datadoghq.com".
  • host default is now derived from site:
    • HTTP forwarding: http-intake.logs.<site>
    • TCP forwarding (use_http false): agent-intake.logs.<site>
  • An explicitly configured host always wins over the site-derived default — this preserves backwards compatibility for any existing config that pins host.
  • README updated with the new parameter and the list of valid sites (datadoghq.com, datadoghq.eu, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ddog-gov.com).

Test plan

  • bundle exec rake test — 34 tests, 71 assertions, 0 failures (baseline was 29 tests; 5 new tests added)
  • Default config (no site, no host) still resolves to http-intake.logs.datadoghq.com
  • site datadoghq.eu resolves HTTP host to http-intake.logs.datadoghq.eu
  • site us5.datadoghq.com with use_http false resolves TCP host to agent-intake.logs.us5.datadoghq.com
  • Explicit host my-custom-intake.example.com overrides site-derived default (HTTP and TCP)
  • Manual smoke test against a live EU site (recommended before merge)

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

@gh123man gh123man marked this pull request as ready for review May 18, 2026 16:17
@gh123man gh123man requested a review from a team as a code owner May 18, 2026 16:17
Comment thread lib/fluent/plugin/out_datadog.rb
Comment thread lib/fluent/plugin/out_datadog.rb
@gh123man gh123man requested a review from ddrthall May 20, 2026 19:56
Comment thread lib/fluent/plugin/out_datadog.rb Outdated
Comment thread test/plugin/test_out_datadog.rb
gh123man and others added 7 commits June 9, 2026 09:49
Adds a `site` configuration parameter (default `datadoghq.com`) that
derives the default intake host. Explicit `host` values continue to win
over the site-derived default. The `host` default is now derived as:

  - HTTP forwarding: `http-intake.logs.<site>`
  - TCP forwarding:  `agent-intake.logs.<site>`

Supports the standard Datadog sites (`datadoghq.com`, `datadoghq.eu`,
`us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`,
`ddog-gov.com`). README updated; tests cover default, EU site, TCP
site derivation, and explicit `host` override precedence.

JIRA: https://datadoghq.atlassian.net/browse/AGNTLOG-182

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Preserves the previously-documented TCP intake host (intake.logs.datadoghq.com)
that existing users rely on, instead of switching to agent-intake.logs.<site>.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
TCP is deprecated and out of scope for the site config feature.
Removed the TCP host prefix constant, TCP-aware derivation, and the
TCP-specific tests. Site now only changes the default HTTP host.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The previous commit removed master's existing TCP-mode host fallback
(swap to DD_DEFAULT_TCP_ENDPOINT when use_http=false and host is the
default HTTP endpoint). That existed before this PR and should not
have been removed. Restored the block verbatim in its original position
(after `return if @dd_hostname`) and re-added the derived
DD_DEFAULT_HTTP_ENDPOINT constant it compares against.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…owlist validation

C1: Only derive `http-intake.logs.<site>` host when `use_http` is true.
TCP users with a non-default site were silently receiving an HTTP intake
hostname, which is now prevented. TCP + default site retains the legacy
fallback to DD_DEFAULT_TCP_ENDPOINT.

R1: Validate `site` against a shape regex on configure, raising
Fluent::ConfigError for values that don't match the documented pattern
(e.g. "datadog.eu" instead of "datadoghq.eu").

Adds 8 tests covering: HTTP site derivation, TCP fallback, TCP with
explicit host, invalid site rejection, gov site, and subdomain site.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The Datadog Agent does not validate the `site` config string — see
pkg/config/setup/common_settings.go:1135 (`BindEnv("site")` only, no
default, no validation) and pkg/config/utils/endpoints.go:72-73 where
`GetMainEndpoint` builds the URL as `prefix + strings.TrimSpace(site)`.
A typo like `site: datadog.eu` produces `agent-http-intake.logs.datadog.eu`
and surfaces at DNS resolution time.

Removes the DD_SITE_PATTERN regex + ConfigError raise added in 9dd80a3
so this plugin matches that behavior. Also matches the sibling
serilog-sinks-datadog-logs and logstash-output-datadog_logs `site`
work, which document valid sites in their README but do not validate
at runtime.

Documentation in the README is kept — that's the validation channel
we use across the Datadog product surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…rror

Addresses Cursor review C1/C2 on #86. Before this change, the
combination of `use_http false` + a non-default `site` + no explicit
`host` left `@host` as nil/empty in `configure`, and the failure only
surfaced at connect-time inside the TCP client as a cryptic error. The
existing test that claimed to exercise this branch actually passed an
explicit `host` and validated the wrong path.

Raise `Fluent::ConfigError` for this case with an actionable message
pointing at the likely TCP intake hostname (`intake.logs.<site>`).
Replace the misleading test with one that drives the genuinely new
branch and asserts the raise.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@gh123man gh123man force-pushed the claude/AGNTLOG-182-add-site-config branch from 4600947 to 0531144 Compare June 9, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants