UNPKG

@loglayer/transport-victoria-logs

Version:

VictoriaLogs transport for the LogLayer logging library.

54 lines (53 loc) 1.96 kB
import { HttpTransport, HttpTransportConfig } from "@loglayer/transport-http"; //#region src/VictoriaLogsTransport.d.ts /** * Configuration options for the VictoriaLogs transport. * This is essentially a wrapper around HttpTransport with VictoriaLogs specific defaults. */ interface VictoriaLogsTransportConfig extends Omit<HttpTransportConfig, "url" | "payloadTemplate"> { /** * The VictoriaLogs host URL (e.g., http://localhost:9428) * The /insert/jsonline path will be automatically appended * @default "http://localhost:9428" */ url?: string; /** * Function to transform log data into the payload format (optional, defaults to VictoriaLogs format) */ payloadTemplate?: (data: { logLevel: string; message: string; data?: Record<string, any>; }) => string; /** * Function to generate stream-level fields for VictoriaLogs * The keys of the returned object will be used as the values for the _stream_fields parameter * @default () => ({}) */ streamFields?: () => Record<string, string>; /** * Function to generate the timestamp for the _time field * @default () => new Date().toISOString() */ timestamp?: () => string; /** * Custom HTTP query parameters for VictoriaLogs ingestion * @see https://docs.victoriametrics.com/victorialogs/data-ingestion/#http-parameters */ httpParameters?: Record<string, string>; } /** * VictoriaLogs transport for LogLayer. * * This transport is a thin wrapper around the HttpTransport that provides * VictoriaLogs specific defaults and configuration. It uses the VictoriaLogs * JSON stream API to send logs. * * @see https://docs.victoriametrics.com/victorialogs/data-ingestion/#json-stream-api */ declare class VictoriaLogsTransport extends HttpTransport { constructor(config?: VictoriaLogsTransportConfig); } //#endregion export { VictoriaLogsTransport, type VictoriaLogsTransportConfig }; //# sourceMappingURL=index.d.mts.map