@dx-do/client 6.1.0 → 6.1.1
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.js +41 -42
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +41 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/src/lib/model/log/ingest.d.ts +23 -4
- package/dist/src/lib/model/log/ingest.d.ts.map +1 -1
- package/dist/src/lib/services/logs.service.d.ts +12 -6
- package/dist/src/lib/services/logs.service.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -73446,55 +73446,54 @@ class LogsService {
|
|
|
73446
73446
|
queryLogs(logQueryBody) {
|
|
73447
73447
|
return this.dxSaasService.oiPost('oi/loganalytics/v1/api/logs/filter', logQueryBody);
|
|
73448
73448
|
}
|
|
73449
|
-
/** Ingests a single log entry into the log gateway. */
|
|
73450
|
-
ingestLog(entry) {
|
|
73451
|
-
return this.ingestLogs([entry]);
|
|
73452
|
-
}
|
|
73453
73449
|
/**
|
|
73454
|
-
* Builds the enriched payload
|
|
73455
|
-
*
|
|
73450
|
+
* Builds the enriched payload object for a single log entry.
|
|
73451
|
+
*
|
|
73452
|
+
* @param options - Known log entry fields (all optional with sensible defaults).
|
|
73453
|
+
* @param additionalFields - Arbitrary extra fields to include in the indexed document.
|
|
73454
|
+
* @returns The payload object ready to POST to the uim_logs ingestion endpoint.
|
|
73456
73455
|
*/
|
|
73457
|
-
buildLogPayload(
|
|
73456
|
+
buildLogPayload(options, additionalFields) {
|
|
73458
73457
|
const cohortId = this.dxSaasService.dxdoConfiguration.dxConfiguration.cohortId;
|
|
73459
73458
|
const tenantIdUpper = cohortId.toUpperCase();
|
|
73460
|
-
const
|
|
73461
|
-
|
|
73462
|
-
|
|
73463
|
-
|
|
73464
|
-
|
|
73465
|
-
|
|
73466
|
-
|
|
73467
|
-
|
|
73468
|
-
|
|
73469
|
-
|
|
73470
|
-
|
|
73471
|
-
|
|
73472
|
-
|
|
73473
|
-
|
|
73474
|
-
|
|
73475
|
-
|
|
73476
|
-
|
|
73477
|
-
|
|
73478
|
-
|
|
73479
|
-
|
|
73480
|
-
|
|
73481
|
-
|
|
73482
|
-
|
|
73483
|
-
|
|
73484
|
-
|
|
73485
|
-
|
|
73486
|
-
|
|
73487
|
-
|
|
73488
|
-
|
|
73489
|
-
|
|
73490
|
-
|
|
73491
|
-
|
|
73492
|
-
|
|
73493
|
-
|
|
73459
|
+
const logtype = options.logtype ?? 'generic';
|
|
73460
|
+
const host = options.host ?? require$$0$4.hostname();
|
|
73461
|
+
const ip = options.ip ?? detectIPv4();
|
|
73462
|
+
const agentInstance = options.agentInstance ?? 'dx-do';
|
|
73463
|
+
const agentName = options.agentName ?? 'Logs Collector';
|
|
73464
|
+
const containerId = options.containerId ?? host;
|
|
73465
|
+
const containerName = options.containerName ?? agentInstance;
|
|
73466
|
+
const file = options.file ?? 'dx-do.cli';
|
|
73467
|
+
const tag = `${logtype} logs`;
|
|
73468
|
+
// temp_fields must have exactly 9 space-separated components before the message
|
|
73469
|
+
// is appended by the SaaS filter (agentbase_msg = temp_fields + " " + message).
|
|
73470
|
+
// The Kafka consumer parses positionally: [0]=tenant [1]=logtype [2]=host
|
|
73471
|
+
// [3]=container_id [4]=container_name [5]=ip [6-7]=tags [8]=source_file [9+]=message.
|
|
73472
|
+
const temp_fields = `${tenantIdUpper} ${logtype} ${host} ${containerId} ${containerName} ${ip} ${tag} ${file}`;
|
|
73473
|
+
return {
|
|
73474
|
+
'@timestamp': options.timestamp ?? new Date().toISOString(),
|
|
73475
|
+
// logtype must be top-level: the SaaS filter does `update => ["type", "%{logtype}"]`
|
|
73476
|
+
// which drives Kafka consumer index routing — without it type stays as "ingestionapi"
|
|
73477
|
+
logtype,
|
|
73478
|
+
message: options.message,
|
|
73479
|
+
host: { name: host, hostname: host },
|
|
73480
|
+
tenant_id: tenantIdUpper,
|
|
73481
|
+
temp_fields,
|
|
73482
|
+
tags: [tag],
|
|
73483
|
+
__agent_name: agentName,
|
|
73484
|
+
__agent_instance: agentInstance,
|
|
73485
|
+
container_id: containerId,
|
|
73486
|
+
container_name: containerName,
|
|
73487
|
+
...additionalFields,
|
|
73488
|
+
};
|
|
73489
|
+
}
|
|
73490
|
+
/** Ingests a single log entry into the log gateway. */
|
|
73491
|
+
ingestLog(options, additionalFields) {
|
|
73492
|
+
return this.dxSaasService.logPost('mdo/v2/aoanalytics/ingestion/uim_logs', [this.buildLogPayload(options, additionalFields)]);
|
|
73494
73493
|
}
|
|
73495
73494
|
/** Ingests a batch of log entries into the log gateway. */
|
|
73496
73495
|
ingestLogs(entries) {
|
|
73497
|
-
return this.dxSaasService.logPost('mdo/v2/aoanalytics/ingestion/uim_logs', this.buildLogPayload(
|
|
73496
|
+
return this.dxSaasService.logPost('mdo/v2/aoanalytics/ingestion/uim_logs', entries.map((e) => this.buildLogPayload(e.options, e.additionalFields)));
|
|
73498
73497
|
}
|
|
73499
73498
|
}
|
|
73500
73499
|
|