A transport for the LogLayer logging library to send logs to Dynatrace using their Log Monitoring API v2.
npm install loglayer @loglayer/transport-dynatrace serialize-error
You will need an access token with the logs.ingest
scope. See access token documentation for more details.
import { LogLayer } from 'loglayer'
import { DynatraceTransport } from "@loglayer/transport-dynatrace"
const log = new LogLayer({
errorSerializer: serializeError,
transport: new DynatraceTransport({
url: "https://your-environment-id.live.dynatrace.com/api/v2/logs/ingest",
ingestToken: "your-api-token",
onError: (error) => console.error('Failed to send log:', error)
})
})
log.info('Hello world')
For more details, visit https://loglayer.dev/transports/dynatrace