@loglayer/transport-cribl-http 1.1.0 → 1.3.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/dist/index.cjs +2 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let _loglayer_transport_http = require("@loglayer/transport-http");
|
|
3
|
-
|
|
4
3
|
//#region src/CriblTransport.ts
|
|
5
4
|
/**
|
|
6
5
|
* CriblTransport sends logs to Cribl Stream via the HTTP/S Bulk API source.
|
|
@@ -60,7 +59,7 @@ var CriblTransport = class extends _loglayer_transport_http.HttpTransport {
|
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
};
|
|
63
|
-
|
|
64
62
|
//#endregion
|
|
65
63
|
exports.CriblTransport = CriblTransport;
|
|
64
|
+
|
|
66
65
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +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":"
|
|
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,yBAAAA,cAAc;CAChD,YAAY,QAA8B;EACxC,MAAM,WAAW,OAAO,YAAY;EACpC,MAAM,UAAU,GAAG,OAAO,IAAI,QAAQ,OAAO,EAAE,IAAI,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,IAAI,IAAI,GAAI;KACxC,eAAe;IAChB,OAAO;GACT;GAEA,IAAI,QAAQ,MAAM,SAAS;GAC3B,IAAI,MAAM,MAAM,OAAO;GAEvB,IAAI,MACF,OAAO,OAAO,OAAO,IAAI;GAG3B,OAAO,KAAK,UAAU,KAAK;EAC7B;EAEF,MAAM,iBAAyC,EAC7C,gBAAgB,mBAClB;EAEA,IAAI,OAAO,OACT,eAAe,gBAAgB,OAAO;EAGxC,MAAM,gBAAgB,OAAO,UAAU;GAAE,GAAG;GAAgB,GAAG,OAAO;EAAQ,IAAI;EAGlF,MAAM,aAAa,EAAE,GAAG,OAAO;EAC/B,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAElB,MAAM;GACJ,KAAK;GACL,QAAQ;GACR,SAAS;GACT;GACA,GAAG;EACL,CAAC;CACH;AACF"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HttpTransport } from "@loglayer/transport-http";
|
|
2
|
-
|
|
3
2
|
//#region src/CriblTransport.ts
|
|
4
3
|
/**
|
|
5
4
|
* CriblTransport sends logs to Cribl Stream via the HTTP/S Bulk API source.
|
|
@@ -59,7 +58,7 @@ var CriblTransport = class extends HttpTransport {
|
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
};
|
|
62
|
-
|
|
63
61
|
//#endregion
|
|
64
62
|
export { CriblTransport };
|
|
63
|
+
|
|
65
64
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +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":"
|
|
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,EAAE,IAAI,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,IAAI,IAAI,GAAI;KACxC,eAAe;IAChB,OAAO;GACT;GAEA,IAAI,QAAQ,MAAM,SAAS;GAC3B,IAAI,MAAM,MAAM,OAAO;GAEvB,IAAI,MACF,OAAO,OAAO,OAAO,IAAI;GAG3B,OAAO,KAAK,UAAU,KAAK;EAC7B;EAEF,MAAM,iBAAyC,EAC7C,gBAAgB,mBAClB;EAEA,IAAI,OAAO,OACT,eAAe,gBAAgB,OAAO;EAGxC,MAAM,gBAAgB,OAAO,UAAU;GAAE,GAAG;GAAgB,GAAG,OAAO;EAAQ,IAAI;EAGlF,MAAM,aAAa,EAAE,GAAG,OAAO;EAC/B,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW;EAElB,MAAM;GACJ,KAAK;GACL,QAAQ;GACR,SAAS;GACT;GACA,GAAG;EACL,CAAC;CACH;AACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loglayer/transport-cribl-http",
|
|
3
3
|
"description": "Cribl HTTP/S transport for the LogLayer logging library.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"http"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loglayer/transport-http": "2.
|
|
36
|
+
"@loglayer/transport-http": "2.4.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "25.
|
|
40
|
-
"dotenv": "17.
|
|
39
|
+
"@types/node": "25.9.1",
|
|
40
|
+
"dotenv": "17.4.2",
|
|
41
41
|
"serialize-error": "13.0.1",
|
|
42
|
-
"tsdown": "0.
|
|
43
|
-
"tsx": "4.
|
|
44
|
-
"typescript": "
|
|
45
|
-
"vitest": "4.
|
|
42
|
+
"tsdown": "0.22.1",
|
|
43
|
+
"tsx": "4.22.3",
|
|
44
|
+
"typescript": "6.0.3",
|
|
45
|
+
"vitest": "4.1.7",
|
|
46
46
|
"@internal/tsconfig": "2.1.0",
|
|
47
|
-
"@loglayer/transport": "3.
|
|
48
|
-
"loglayer": "9.
|
|
47
|
+
"@loglayer/transport": "3.3.0",
|
|
48
|
+
"loglayer": "9.4.0"
|
|
49
49
|
},
|
|
50
50
|
"bugs": "https://github.com/loglayer/loglayer/issues",
|
|
51
51
|
"engines": {
|