@loglayer/transport-cribl-http 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Theo Gravity / [Disaresta](https://disaresta.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Cribl HTTP/S Transport for LogLayer
2
+
3
+ [![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-cribl-http)](https://www.npmjs.com/package/@loglayer/transport-cribl-http)
4
+ [![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-cribl-http)](https://www.npmjs.com/package/@loglayer/transport-cribl-http)
5
+ [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
6
+
7
+ A Cribl HTTP/S transport for the [LogLayer](https://loglayer.dev) logging library.
8
+
9
+ Ships logs to [Cribl Stream](https://cribl.io) via the [HTTP/S Bulk API source](https://docs.cribl.io/stream/sources-https/) (`/cribl/_bulk`). Features include:
10
+ - Automatic Cribl HTTP/S Bulk API JSON format
11
+ - Built on top of the robust HTTP transport
12
+ - Retry logic with exponential backoff
13
+ - Rate limiting support
14
+ - Batch sending with configurable size and timeout
15
+ - Error and debug callbacks
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install loglayer @loglayer/transport-cribl-http serialize-error
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```typescript
26
+ import { LogLayer } from 'loglayer'
27
+ import { CriblTransport } from "@loglayer/transport-cribl-http"
28
+ import { serializeError } from "serialize-error";
29
+
30
+ const log = new LogLayer({
31
+ errorSerializer: serializeError,
32
+ transport: new CriblTransport({
33
+ url: "https://your-cribl-instance:10080",
34
+ token: "YOUR-AUTH-TOKEN",
35
+ source: "my-app",
36
+ host: "server-01",
37
+ })
38
+ })
39
+
40
+ // Use the logger
41
+ log.info("This is a test message");
42
+ log.withMetadata({ userId: "123" }).error("User not found");
43
+ ```
44
+
45
+ ## Documentation
46
+
47
+ For more details, visit [https://loglayer.dev/transports/cribl](https://loglayer.dev/transports/cribl)
package/dist/index.cjs ADDED
@@ -0,0 +1,66 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _loglayer_transport_http = require("@loglayer/transport-http");
3
+
4
+ //#region src/CriblTransport.ts
5
+ /**
6
+ * CriblTransport sends logs to Cribl Stream via the HTTP/S Bulk API source.
7
+ * It extends HttpTransport with Cribl-specific configuration.
8
+ *
9
+ * Uses the Cribl HTTP event API endpoint (`/cribl/_bulk`) which accepts
10
+ * newline-delimited JSON events.
11
+ *
12
+ * Features:
13
+ * - Automatic Cribl HTTP Bulk API JSON format
14
+ * - Built on top of the robust HTTP transport
15
+ * - Retry logic with exponential backoff (via HttpTransport)
16
+ * - Rate limiting support (via HttpTransport)
17
+ * - Batch sending with configurable size and timeout (via HttpTransport)
18
+ * - Error and debug callbacks
19
+ */
20
+ var CriblTransport = class extends _loglayer_transport_http.HttpTransport {
21
+ constructor(config) {
22
+ const basePath = config.basePath ?? "/cribl";
23
+ const fullUrl = `${config.url.replace(/\/$/, "")}${basePath}/_bulk`;
24
+ const { source, host } = config;
25
+ const messageField = config.messageField ?? "_raw";
26
+ const timeField = config.timeField ?? "_time";
27
+ const payloadTemplate = config.payloadTemplate ?? (({ logLevel, message, data }) => {
28
+ const event = {
29
+ [timeField]: Math.floor(Date.now() / 1e3),
30
+ [messageField]: message,
31
+ level: logLevel
32
+ };
33
+ if (source) event.source = source;
34
+ if (host) event.host = host;
35
+ if (data) Object.assign(event, data);
36
+ return JSON.stringify(event);
37
+ });
38
+ const defaultHeaders = { "Content-Type": "application/json" };
39
+ if (config.token) defaultHeaders.Authorization = config.token;
40
+ const mergedHeaders = config.headers ? {
41
+ ...defaultHeaders,
42
+ ...config.headers
43
+ } : defaultHeaders;
44
+ const httpConfig = { ...config };
45
+ delete httpConfig.url;
46
+ delete httpConfig.token;
47
+ delete httpConfig.source;
48
+ delete httpConfig.host;
49
+ delete httpConfig.messageField;
50
+ delete httpConfig.timeField;
51
+ delete httpConfig.basePath;
52
+ delete httpConfig.headers;
53
+ delete httpConfig.payloadTemplate;
54
+ super({
55
+ url: fullUrl,
56
+ method: "POST",
57
+ headers: mergedHeaders,
58
+ payloadTemplate,
59
+ ...httpConfig
60
+ });
61
+ }
62
+ };
63
+
64
+ //#endregion
65
+ exports.CriblTransport = CriblTransport;
66
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["HttpTransport"],"sources":["../src/CriblTransport.ts"],"sourcesContent":["import type { HttpTransportConfig } from \"@loglayer/transport-http\";\nimport { HttpTransport } from \"@loglayer/transport-http\";\n\n/**\n * Configuration options for the Cribl transport.\n * Sends logs to Cribl Stream via the HTTP/S Bulk API source.\n */\nexport interface CriblTransportConfig extends Omit<HttpTransportConfig, \"url\" | \"headers\" | \"payloadTemplate\"> {\n /**\n * The Cribl Stream instance URL (e.g., \"https://cribl.example.com:10080\")\n * Default port is 10080 for the HTTP/S source.\n */\n url: string;\n /**\n * The auth token configured in the Cribl HTTP source.\n * Sent as `Authorization: <token>` header.\n */\n token?: string;\n /**\n * Optional source value for events\n */\n source?: string;\n /**\n * Optional host value for events\n */\n host?: string;\n /**\n * The field name used for the log message in the event payload.\n * @default \"_raw\"\n */\n messageField?: string;\n /**\n * The field name used for the timestamp in the event payload.\n * @default \"_time\"\n */\n timeField?: string;\n /**\n * The base path for the Cribl HTTP event API.\n * @default \"/cribl\"\n */\n basePath?: string;\n /**\n * Custom headers to include in requests (merged with default headers)\n */\n headers?: Record<string, string>;\n /**\n * Function to transform log data into the payload format.\n * Defaults to Cribl HTTP Bulk API JSON format with `_raw`, `_time`, `host`, and `source` fields.\n */\n payloadTemplate?: (data: { logLevel: string; message: string; data?: Record<string, any> }) => string;\n}\n\n/**\n * CriblTransport sends logs to Cribl Stream via the HTTP/S Bulk API source.\n * It extends HttpTransport with Cribl-specific configuration.\n *\n * Uses the Cribl HTTP event API endpoint (`/cribl/_bulk`) which accepts\n * newline-delimited JSON events.\n *\n * Features:\n * - Automatic Cribl HTTP Bulk API JSON format\n * - Built on top of the robust HTTP transport\n * - Retry logic with exponential backoff (via HttpTransport)\n * - Rate limiting support (via HttpTransport)\n * - Batch sending with configurable size and timeout (via HttpTransport)\n * - Error and debug callbacks\n */\nexport class CriblTransport extends HttpTransport {\n constructor(config: CriblTransportConfig) {\n const basePath = config.basePath ?? \"/cribl\";\n const fullUrl = `${config.url.replace(/\\/$/, \"\")}${basePath}/_bulk`;\n\n const { source, host } = config;\n const messageField = config.messageField ?? \"_raw\";\n const timeField = config.timeField ?? \"_time\";\n\n const payloadTemplate =\n config.payloadTemplate ??\n (({ logLevel, message, data }) => {\n const event: Record<string, any> = {\n [timeField]: Math.floor(Date.now() / 1000),\n [messageField]: message,\n level: logLevel,\n };\n\n if (source) event.source = source;\n if (host) event.host = host;\n\n if (data) {\n Object.assign(event, data);\n }\n\n return JSON.stringify(event);\n });\n\n const defaultHeaders: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n };\n\n if (config.token) {\n defaultHeaders.Authorization = config.token;\n }\n\n const mergedHeaders = config.headers ? { ...defaultHeaders, ...config.headers } : defaultHeaders;\n\n // Create HTTP transport config, excluding Cribl-specific properties\n const httpConfig = { ...config };\n delete httpConfig.url;\n delete httpConfig.token;\n delete httpConfig.source;\n delete httpConfig.host;\n delete httpConfig.messageField;\n delete httpConfig.timeField;\n delete httpConfig.basePath;\n delete httpConfig.headers;\n delete httpConfig.payloadTemplate;\n\n super({\n url: fullUrl,\n method: \"POST\",\n headers: mergedHeaders,\n payloadTemplate,\n ...httpConfig,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmEA,IAAa,iBAAb,cAAoCA,uCAAc;CAChD,YAAY,QAA8B;EACxC,MAAM,WAAW,OAAO,YAAY;EACpC,MAAM,UAAU,GAAG,OAAO,IAAI,QAAQ,OAAO,GAAG,GAAG,SAAS;EAE5D,MAAM,EAAE,QAAQ,SAAS;EACzB,MAAM,eAAe,OAAO,gBAAgB;EAC5C,MAAM,YAAY,OAAO,aAAa;EAEtC,MAAM,kBACJ,OAAO,qBACL,EAAE,UAAU,SAAS,WAAW;GAChC,MAAM,QAA6B;KAChC,YAAY,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK;KACzC,eAAe;IAChB,OAAO;IACR;AAED,OAAI,OAAQ,OAAM,SAAS;AAC3B,OAAI,KAAM,OAAM,OAAO;AAEvB,OAAI,KACF,QAAO,OAAO,OAAO,KAAK;AAG5B,UAAO,KAAK,UAAU,MAAM;;EAGhC,MAAM,iBAAyC,EAC7C,gBAAgB,oBACjB;AAED,MAAI,OAAO,MACT,gBAAe,gBAAgB,OAAO;EAGxC,MAAM,gBAAgB,OAAO,UAAU;GAAE,GAAG;GAAgB,GAAG,OAAO;GAAS,GAAG;EAGlF,MAAM,aAAa,EAAE,GAAG,QAAQ;AAChC,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAElB,QAAM;GACJ,KAAK;GACL,QAAQ;GACR,SAAS;GACT;GACA,GAAG;GACJ,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { HttpTransport, HttpTransportConfig } from "@loglayer/transport-http";
2
+
3
+ //#region src/CriblTransport.d.ts
4
+ /**
5
+ * Configuration options for the Cribl transport.
6
+ * Sends logs to Cribl Stream via the HTTP/S Bulk API source.
7
+ */
8
+ interface CriblTransportConfig extends Omit<HttpTransportConfig, "url" | "headers" | "payloadTemplate"> {
9
+ /**
10
+ * The Cribl Stream instance URL (e.g., "https://cribl.example.com:10080")
11
+ * Default port is 10080 for the HTTP/S source.
12
+ */
13
+ url: string;
14
+ /**
15
+ * The auth token configured in the Cribl HTTP source.
16
+ * Sent as `Authorization: <token>` header.
17
+ */
18
+ token?: string;
19
+ /**
20
+ * Optional source value for events
21
+ */
22
+ source?: string;
23
+ /**
24
+ * Optional host value for events
25
+ */
26
+ host?: string;
27
+ /**
28
+ * The field name used for the log message in the event payload.
29
+ * @default "_raw"
30
+ */
31
+ messageField?: string;
32
+ /**
33
+ * The field name used for the timestamp in the event payload.
34
+ * @default "_time"
35
+ */
36
+ timeField?: string;
37
+ /**
38
+ * The base path for the Cribl HTTP event API.
39
+ * @default "/cribl"
40
+ */
41
+ basePath?: string;
42
+ /**
43
+ * Custom headers to include in requests (merged with default headers)
44
+ */
45
+ headers?: Record<string, string>;
46
+ /**
47
+ * Function to transform log data into the payload format.
48
+ * Defaults to Cribl HTTP Bulk API JSON format with `_raw`, `_time`, `host`, and `source` fields.
49
+ */
50
+ payloadTemplate?: (data: {
51
+ logLevel: string;
52
+ message: string;
53
+ data?: Record<string, any>;
54
+ }) => string;
55
+ }
56
+ /**
57
+ * CriblTransport sends logs to Cribl Stream via the HTTP/S Bulk API source.
58
+ * It extends HttpTransport with Cribl-specific configuration.
59
+ *
60
+ * Uses the Cribl HTTP event API endpoint (`/cribl/_bulk`) which accepts
61
+ * newline-delimited JSON events.
62
+ *
63
+ * Features:
64
+ * - Automatic Cribl HTTP Bulk API JSON format
65
+ * - Built on top of the robust HTTP transport
66
+ * - Retry logic with exponential backoff (via HttpTransport)
67
+ * - Rate limiting support (via HttpTransport)
68
+ * - Batch sending with configurable size and timeout (via HttpTransport)
69
+ * - Error and debug callbacks
70
+ */
71
+ declare class CriblTransport extends HttpTransport {
72
+ constructor(config: CriblTransportConfig);
73
+ }
74
+ //#endregion
75
+ export { CriblTransport, type CriblTransportConfig };
76
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1,76 @@
1
+ import { HttpTransport, HttpTransportConfig } from "@loglayer/transport-http";
2
+
3
+ //#region src/CriblTransport.d.ts
4
+ /**
5
+ * Configuration options for the Cribl transport.
6
+ * Sends logs to Cribl Stream via the HTTP/S Bulk API source.
7
+ */
8
+ interface CriblTransportConfig extends Omit<HttpTransportConfig, "url" | "headers" | "payloadTemplate"> {
9
+ /**
10
+ * The Cribl Stream instance URL (e.g., "https://cribl.example.com:10080")
11
+ * Default port is 10080 for the HTTP/S source.
12
+ */
13
+ url: string;
14
+ /**
15
+ * The auth token configured in the Cribl HTTP source.
16
+ * Sent as `Authorization: <token>` header.
17
+ */
18
+ token?: string;
19
+ /**
20
+ * Optional source value for events
21
+ */
22
+ source?: string;
23
+ /**
24
+ * Optional host value for events
25
+ */
26
+ host?: string;
27
+ /**
28
+ * The field name used for the log message in the event payload.
29
+ * @default "_raw"
30
+ */
31
+ messageField?: string;
32
+ /**
33
+ * The field name used for the timestamp in the event payload.
34
+ * @default "_time"
35
+ */
36
+ timeField?: string;
37
+ /**
38
+ * The base path for the Cribl HTTP event API.
39
+ * @default "/cribl"
40
+ */
41
+ basePath?: string;
42
+ /**
43
+ * Custom headers to include in requests (merged with default headers)
44
+ */
45
+ headers?: Record<string, string>;
46
+ /**
47
+ * Function to transform log data into the payload format.
48
+ * Defaults to Cribl HTTP Bulk API JSON format with `_raw`, `_time`, `host`, and `source` fields.
49
+ */
50
+ payloadTemplate?: (data: {
51
+ logLevel: string;
52
+ message: string;
53
+ data?: Record<string, any>;
54
+ }) => string;
55
+ }
56
+ /**
57
+ * CriblTransport sends logs to Cribl Stream via the HTTP/S Bulk API source.
58
+ * It extends HttpTransport with Cribl-specific configuration.
59
+ *
60
+ * Uses the Cribl HTTP event API endpoint (`/cribl/_bulk`) which accepts
61
+ * newline-delimited JSON events.
62
+ *
63
+ * Features:
64
+ * - Automatic Cribl HTTP Bulk API JSON format
65
+ * - Built on top of the robust HTTP transport
66
+ * - Retry logic with exponential backoff (via HttpTransport)
67
+ * - Rate limiting support (via HttpTransport)
68
+ * - Batch sending with configurable size and timeout (via HttpTransport)
69
+ * - Error and debug callbacks
70
+ */
71
+ declare class CriblTransport extends HttpTransport {
72
+ constructor(config: CriblTransportConfig);
73
+ }
74
+ //#endregion
75
+ export { CriblTransport, type CriblTransportConfig };
76
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs ADDED
@@ -0,0 +1,65 @@
1
+ import { HttpTransport } from "@loglayer/transport-http";
2
+
3
+ //#region src/CriblTransport.ts
4
+ /**
5
+ * CriblTransport sends logs to Cribl Stream via the HTTP/S Bulk API source.
6
+ * It extends HttpTransport with Cribl-specific configuration.
7
+ *
8
+ * Uses the Cribl HTTP event API endpoint (`/cribl/_bulk`) which accepts
9
+ * newline-delimited JSON events.
10
+ *
11
+ * Features:
12
+ * - Automatic Cribl HTTP Bulk API JSON format
13
+ * - Built on top of the robust HTTP transport
14
+ * - Retry logic with exponential backoff (via HttpTransport)
15
+ * - Rate limiting support (via HttpTransport)
16
+ * - Batch sending with configurable size and timeout (via HttpTransport)
17
+ * - Error and debug callbacks
18
+ */
19
+ var CriblTransport = class extends HttpTransport {
20
+ constructor(config) {
21
+ const basePath = config.basePath ?? "/cribl";
22
+ const fullUrl = `${config.url.replace(/\/$/, "")}${basePath}/_bulk`;
23
+ const { source, host } = config;
24
+ const messageField = config.messageField ?? "_raw";
25
+ const timeField = config.timeField ?? "_time";
26
+ const payloadTemplate = config.payloadTemplate ?? (({ logLevel, message, data }) => {
27
+ const event = {
28
+ [timeField]: Math.floor(Date.now() / 1e3),
29
+ [messageField]: message,
30
+ level: logLevel
31
+ };
32
+ if (source) event.source = source;
33
+ if (host) event.host = host;
34
+ if (data) Object.assign(event, data);
35
+ return JSON.stringify(event);
36
+ });
37
+ const defaultHeaders = { "Content-Type": "application/json" };
38
+ if (config.token) defaultHeaders.Authorization = config.token;
39
+ const mergedHeaders = config.headers ? {
40
+ ...defaultHeaders,
41
+ ...config.headers
42
+ } : defaultHeaders;
43
+ const httpConfig = { ...config };
44
+ delete httpConfig.url;
45
+ delete httpConfig.token;
46
+ delete httpConfig.source;
47
+ delete httpConfig.host;
48
+ delete httpConfig.messageField;
49
+ delete httpConfig.timeField;
50
+ delete httpConfig.basePath;
51
+ delete httpConfig.headers;
52
+ delete httpConfig.payloadTemplate;
53
+ super({
54
+ url: fullUrl,
55
+ method: "POST",
56
+ headers: mergedHeaders,
57
+ payloadTemplate,
58
+ ...httpConfig
59
+ });
60
+ }
61
+ };
62
+
63
+ //#endregion
64
+ export { CriblTransport };
65
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/CriblTransport.ts"],"sourcesContent":["import type { HttpTransportConfig } from \"@loglayer/transport-http\";\nimport { HttpTransport } from \"@loglayer/transport-http\";\n\n/**\n * Configuration options for the Cribl transport.\n * Sends logs to Cribl Stream via the HTTP/S Bulk API source.\n */\nexport interface CriblTransportConfig extends Omit<HttpTransportConfig, \"url\" | \"headers\" | \"payloadTemplate\"> {\n /**\n * The Cribl Stream instance URL (e.g., \"https://cribl.example.com:10080\")\n * Default port is 10080 for the HTTP/S source.\n */\n url: string;\n /**\n * The auth token configured in the Cribl HTTP source.\n * Sent as `Authorization: <token>` header.\n */\n token?: string;\n /**\n * Optional source value for events\n */\n source?: string;\n /**\n * Optional host value for events\n */\n host?: string;\n /**\n * The field name used for the log message in the event payload.\n * @default \"_raw\"\n */\n messageField?: string;\n /**\n * The field name used for the timestamp in the event payload.\n * @default \"_time\"\n */\n timeField?: string;\n /**\n * The base path for the Cribl HTTP event API.\n * @default \"/cribl\"\n */\n basePath?: string;\n /**\n * Custom headers to include in requests (merged with default headers)\n */\n headers?: Record<string, string>;\n /**\n * Function to transform log data into the payload format.\n * Defaults to Cribl HTTP Bulk API JSON format with `_raw`, `_time`, `host`, and `source` fields.\n */\n payloadTemplate?: (data: { logLevel: string; message: string; data?: Record<string, any> }) => string;\n}\n\n/**\n * CriblTransport sends logs to Cribl Stream via the HTTP/S Bulk API source.\n * It extends HttpTransport with Cribl-specific configuration.\n *\n * Uses the Cribl HTTP event API endpoint (`/cribl/_bulk`) which accepts\n * newline-delimited JSON events.\n *\n * Features:\n * - Automatic Cribl HTTP Bulk API JSON format\n * - Built on top of the robust HTTP transport\n * - Retry logic with exponential backoff (via HttpTransport)\n * - Rate limiting support (via HttpTransport)\n * - Batch sending with configurable size and timeout (via HttpTransport)\n * - Error and debug callbacks\n */\nexport class CriblTransport extends HttpTransport {\n constructor(config: CriblTransportConfig) {\n const basePath = config.basePath ?? \"/cribl\";\n const fullUrl = `${config.url.replace(/\\/$/, \"\")}${basePath}/_bulk`;\n\n const { source, host } = config;\n const messageField = config.messageField ?? \"_raw\";\n const timeField = config.timeField ?? \"_time\";\n\n const payloadTemplate =\n config.payloadTemplate ??\n (({ logLevel, message, data }) => {\n const event: Record<string, any> = {\n [timeField]: Math.floor(Date.now() / 1000),\n [messageField]: message,\n level: logLevel,\n };\n\n if (source) event.source = source;\n if (host) event.host = host;\n\n if (data) {\n Object.assign(event, data);\n }\n\n return JSON.stringify(event);\n });\n\n const defaultHeaders: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n };\n\n if (config.token) {\n defaultHeaders.Authorization = config.token;\n }\n\n const mergedHeaders = config.headers ? { ...defaultHeaders, ...config.headers } : defaultHeaders;\n\n // Create HTTP transport config, excluding Cribl-specific properties\n const httpConfig = { ...config };\n delete httpConfig.url;\n delete httpConfig.token;\n delete httpConfig.source;\n delete httpConfig.host;\n delete httpConfig.messageField;\n delete httpConfig.timeField;\n delete httpConfig.basePath;\n delete httpConfig.headers;\n delete httpConfig.payloadTemplate;\n\n super({\n url: fullUrl,\n method: \"POST\",\n headers: mergedHeaders,\n payloadTemplate,\n ...httpConfig,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmEA,IAAa,iBAAb,cAAoC,cAAc;CAChD,YAAY,QAA8B;EACxC,MAAM,WAAW,OAAO,YAAY;EACpC,MAAM,UAAU,GAAG,OAAO,IAAI,QAAQ,OAAO,GAAG,GAAG,SAAS;EAE5D,MAAM,EAAE,QAAQ,SAAS;EACzB,MAAM,eAAe,OAAO,gBAAgB;EAC5C,MAAM,YAAY,OAAO,aAAa;EAEtC,MAAM,kBACJ,OAAO,qBACL,EAAE,UAAU,SAAS,WAAW;GAChC,MAAM,QAA6B;KAChC,YAAY,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK;KACzC,eAAe;IAChB,OAAO;IACR;AAED,OAAI,OAAQ,OAAM,SAAS;AAC3B,OAAI,KAAM,OAAM,OAAO;AAEvB,OAAI,KACF,QAAO,OAAO,OAAO,KAAK;AAG5B,UAAO,KAAK,UAAU,MAAM;;EAGhC,MAAM,iBAAyC,EAC7C,gBAAgB,oBACjB;AAED,MAAI,OAAO,MACT,gBAAe,gBAAgB,OAAO;EAGxC,MAAM,gBAAgB,OAAO,UAAU;GAAE,GAAG;GAAgB,GAAG,OAAO;GAAS,GAAG;EAGlF,MAAM,aAAa,EAAE,GAAG,QAAQ;AAChC,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAClB,SAAO,WAAW;AAElB,QAAM;GACJ,KAAK;GACL,QAAQ;GACR,SAAS;GACT;GACA,GAAG;GACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@loglayer/transport-cribl-http",
3
+ "description": "Cribl HTTP/S transport for the LogLayer logging library.",
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.mjs",
8
+ "exports": {
9
+ "import": {
10
+ "types": "./dist/index.d.mts",
11
+ "import": "./dist/index.mjs"
12
+ },
13
+ "require": {
14
+ "types": "./dist/index.d.cts",
15
+ "require": "./dist/index.cjs"
16
+ }
17
+ },
18
+ "types": "./dist/index.d.mts",
19
+ "sideEffects": false,
20
+ "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/loglayer/loglayer.git",
24
+ "directory": "packages/transports/cribl-http"
25
+ },
26
+ "author": "Theo Gravity <theo@suteki.nu>",
27
+ "keywords": [
28
+ "logging",
29
+ "log",
30
+ "loglayer",
31
+ "cribl",
32
+ "transport",
33
+ "http"
34
+ ],
35
+ "dependencies": {
36
+ "@loglayer/transport-http": "2.1.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "25.2.3",
40
+ "dotenv": "17.3.1",
41
+ "serialize-error": "13.0.1",
42
+ "tsdown": "0.20.3",
43
+ "tsx": "4.21.0",
44
+ "typescript": "5.9.3",
45
+ "vitest": "4.0.18",
46
+ "@internal/tsconfig": "2.1.0",
47
+ "@loglayer/transport": "3.0.2",
48
+ "loglayer": "9.1.0"
49
+ },
50
+ "bugs": "https://github.com/loglayer/loglayer/issues",
51
+ "engines": {
52
+ "node": ">=18"
53
+ },
54
+ "files": [
55
+ "dist"
56
+ ],
57
+ "homepage": "https://loglayer.dev",
58
+ "scripts": {
59
+ "build": "tsdown src/index.ts",
60
+ "test": "vitest --run",
61
+ "clean": "rm -rf .turbo node_modules dist",
62
+ "lint": "biome check --no-errors-on-unmatched --write --unsafe src",
63
+ "lint:staged": "biome check --no-errors-on-unmatched --write --unsafe --staged src",
64
+ "verify-types": "tsc --noEmit",
65
+ "livetest": "tsx src/__tests__/livetest.ts"
66
+ }
67
+ }