
Security News
Happy Birthday, Shai-Hulud
It has been one year since Shai-Hulud made its first appearance on npm.
@sylphx/cat-otlp
Advanced tools
OpenTelemetry Protocol (OTLP) transport for @sylphx/cat logger
1.64 KB • OTLP/HTTP compatible • Automatic batching • Exponential backoff
npm install @sylphx/cat @sylphx/cat-otlp
Exports logs to OpenTelemetry-compatible backends using the OTLP/HTTP protocol. Compatible with Grafana, Datadog, New Relic, AWS CloudWatch, Honeycomb, and any OTLP-compatible observability platform. Features automatic batching, retry logic with exponential backoff, and trace context integration.
import { createLogger } from '@sylphx/cat'
import { otlpTransport } from '@sylphx/cat-otlp'
const logger = createLogger({
transports: [
otlpTransport({
endpoint: 'http://localhost:4318/v1/logs'
})
]
})
logger.info('Hello from OTLP!')
// Exported to OTLP endpoint in OpenTelemetry format
import { otlpTransport } from '@sylphx/cat-otlp'
const logger = createLogger({
transports: [
otlpTransport({
endpoint: 'https://api.honeycomb.io/v1/logs',
headers: {
'x-honeycomb-team': process.env.HONEYCOMB_API_KEY,
'x-honeycomb-dataset': 'my-app'
}
})
]
})
import { otlpTransport } from '@sylphx/cat-otlp'
const logger = createLogger({
transports: [
otlpTransport({
endpoint: 'https://logs-prod-us-central1.grafana.net/otlp/v1/logs',
headers: {
'Authorization': `Basic ${Buffer.from(`${userId}:${apiKey}`).toString('base64')}`
},
resourceAttributes: {
'service.name': 'my-app',
'service.version': '1.0.0',
'environment': 'production'
}
})
]
})
import { otlpTransport } from '@sylphx/cat-otlp'
const logger = createLogger({
transports: [
otlpTransport({
endpoint: 'https://api.example.com/v1/logs',
batch: true,
batchSize: 100, // Send when 100 logs accumulated
batchInterval: 5000, // Or every 5 seconds
retries: 5, // Retry up to 5 times
timeout: 15000 // 15 second timeout
})
]
})
otlpTransport(options?: OTLPTransportOptions): TransportCreates an OTLP transport for exporting logs.
Options:
endpoint?: string - OTLP endpoint URL (default: 'http://localhost:4318/v1/logs')headers?: Record<string, string> - HTTP headers for authenticationbatch?: boolean - Enable batching (default: true)batchSize?: number - Batch size in number of logs (default: 100)batchInterval?: number - Batch interval in milliseconds (default: 1000)compression?: 'none' | 'gzip' - Compression method (default: 'none')retries?: number - Number of retry attempts (default: 3)timeout?: number - Request timeout in milliseconds (default: 10000)resourceAttributes?: Record<string, string | number | boolean> - Resource attributes (service name, version, etc.)scopeName?: string - Instrumentation scope name (default: '@sylphx/cat')scopeVersion?: string - Instrumentation scope versionLogs are automatically converted to the OpenTelemetry log format:
{
"resourceLogs": [{
"resource": {
"attributes": [
{ "key": "service.name", "value": { "stringValue": "my-app" } }
]
},
"scopeLogs": [{
"scope": { "name": "@sylphx/cat" },
"logRecords": [{
"timeUnixNano": "1700000000000000000",
"severityNumber": 9,
"severityText": "INFO",
"body": { "stringValue": "Hello from OTLP!" },
"attributes": [...]
}]
}]
}]
}
trace → 1 (TRACE)debug → 5 (DEBUG)info → 9 (INFO)warn → 13 (WARN)error → 17 (ERROR)fatal → 21 (FATAL)otlpTransport({
endpoint: 'https://http-intake.logs.datadoghq.com/api/v2/logs',
headers: {
'DD-API-KEY': process.env.DATADOG_API_KEY
}
})
otlpTransport({
endpoint: 'https://otlp.nr-data.net/v1/logs',
headers: {
'api-key': process.env.NEW_RELIC_LICENSE_KEY
}
})
otlpTransport({
endpoint: 'http://localhost:4318/v1/logs', // Local OTLP collector
resourceAttributes: {
'service.name': 'my-app',
'aws.region': 'us-east-1'
}
})
When used with @sylphx/cat-tracing, trace IDs are automatically included:
import { tracingPlugin } from '@sylphx/cat-tracing'
import { otlpTransport } from '@sylphx/cat-otlp'
const logger = createLogger({
plugins: [tracingPlugin()],
transports: [otlpTransport({ endpoint: '...' })]
})
logger.info('Traced log')
// Includes traceId, spanId, and traceFlags in OTLP format
const logger = createLogger({
transports: [otlpTransport({ endpoint: '...' })]
})
process.on('SIGTERM', async () => {
await logger.close() // Flushes pending batches and closes transport
process.exit(0)
})
MIT © Kyle Zhu
FAQs
OpenTelemetry Protocol (OTLP) transport for @sylphx/cat logger
The npm package @sylphx/cat-otlp receives a total of 12 weekly downloads. As such, @sylphx/cat-otlp popularity was classified as not popular.
We found that @sylphx/cat-otlp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.