Skip to content

feat(transports/newrelic): add New Relic Log API transport#89

Merged
theogravity merged 1 commit into
mainfrom
features/newrelic-transport
May 11, 2026
Merged

feat(transports/newrelic): add New Relic Log API transport#89
theogravity merged 1 commit into
mainfrom
features/newrelic-transport

Conversation

@theogravity
Copy link
Copy Markdown
Contributor

Summary

New transports/newrelic transport shipping log entries to the New Relic Log API as NDJSON.

Wraps transports/http with New Relic-specific defaults:

  • Zone-aware endpoint (ZoneUS, ZoneEU)
  • Api-Key header from Config.APIKey
  • Optional X-License-Key header from Config.LicenseKey
  • NDJSON encoder with timestamp, message, loglevel, optional hostname
  • AllowInsecureURL opt-in for on-prem forwarders

Follows the exact pattern established by transports/datadog.

What Changed

New module: go.loglayer.dev/transports/newrelic/v2

  • Config: APIKey (required), LicenseKey (optional), Zone (IntakeZone), URL override, Hostname, AllowInsecureURL, HTTP overrides
  • Encoder: NDJSON with New Relic field names (loglevel, not level; timestamp in RFC3339 with milliseconds)
  • Level mapping: Trace and Debug both map to debug; Fatal and Panic map to critical
  • Config.String() redacts both keys; both tagged json:"-"
  • Tests: encoder shape, level mapping, zone URLs, URL override, metadata nesting, credential redaction, Build validation
  • Docs: new page at /transports/newrelic, sidebar entry, transport-list catalog update, whats-new entry
  • Infra: registered in monorel.toml, foreach-module.sh, go.work

Wraps transports/http with New Relic-specific defaults:
- Zone-aware intake URL (US, EU)
- Api-Key / X-License-Key header auth
- NDJSON encoder yielding timestamp, message, loglevel, optional hostname
- AllowInsecureURL flag for non-https URL override (matches datadog pattern)

20 tests covering encoder shape, level mapping, config validation, and
goroutine leak detection.

See https://docs.newrelic.com/docs/logs/log-api/introduction-log-api/
@theogravity theogravity merged commit c77406b into main May 11, 2026
13 checks passed
@theogravity theogravity deleted the features/newrelic-transport branch May 11, 2026 00:27
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.

1 participant