Compare commits

...

14 Commits

Author SHA1 Message Date
36d7cb69a3 2.0.16 2023-08-30 12:49:39 +02:00
4924e0a151 fix(core): update 2023-08-30 12:49:39 +02:00
cd98529541 2.0.15 2023-08-30 12:45:39 +02:00
e6a9282987 fix(core): update 2023-08-30 12:45:39 +02:00
9dcadcd611 2.0.14 2023-08-29 12:11:16 +02:00
4b045ff988 fix(core): update 2023-08-29 12:11:15 +02:00
023dd1b519 2.0.13 2023-08-29 12:10:39 +02:00
4971385eae fix(core): update 2023-08-29 12:10:38 +02:00
e209839962 2.0.12 2023-08-29 11:48:33 +02:00
e44365b674 fix(core): update 2023-08-29 11:48:32 +02:00
bd154089c3 2.0.11 2023-08-29 11:44:49 +02:00
0be693da60 fix(core): update 2023-08-29 11:44:48 +02:00
040c93dec3 2.0.10 2023-08-29 11:43:07 +02:00
21e55bd341 fix(core): update 2023-08-29 11:43:07 +02:00
4 changed files with 15 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@apiclient.xyz/elasticsearch",
"version": "2.0.9",
"version": "2.0.16",
"private": false,
"description": "log to elasticsearch in a kibana compatible format",
"main": "dist_ts/index.js",

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@apiclient.xyz/elasticsearch',
version: '2.0.9',
version: '2.0.16',
description: 'log to elasticsearch in a kibana compatible format'
}

View File

@ -26,6 +26,7 @@ export class ElasticDoc {
private indexInitialized: boolean = false;
private latestTimestamp: string | null = null; // Store the latest timestamp
private onlyNew: boolean = false; // Whether to only pipe new docs
public fastForward: boolean = false; // Whether to fast forward to the latest timestamp
private BATCH_SIZE = 1000;
@ -45,7 +46,7 @@ export class ElasticDoc {
await this.client.indices.create({
index: this.index,
body: {
mappings,
// mappings,
settings: {
// You can define the settings according to your requirements here
},
@ -106,14 +107,22 @@ export class ElasticDoc {
// If 'onlyNew' is true, compare the document timestamp with the latest timestamp
if (this.onlyNew) {
if (this.latestTimestamp && optionsArg.timestamp <= this.latestTimestamp) {
// Omit the document
this.fastForward = true;
} else {
this.fastForward = false;
await this.client.index({
index: this.index,
id: optionsArg.docId,
body: documentBody,
});
}
} else {
this.fastForward = false;
await this.client.index({
index: this.index,
id: optionsArg.docId,
body: documentBody,
});
}
this.sessionDocs.add(optionsArg.docId);
}

View File

@ -54,7 +54,7 @@ export class ElsSmartlogDestination<T> {
return;
}
this.client.index(
await this.client.index(
{
index: indexToUse,
body: {
@ -68,7 +68,7 @@ export class ElsSmartlogDestination<T> {
get logDestination(): ILogDestination {
return {
handleLog: async (smartlogPackageArg: ILogPackage) => {
this.log(smartlogPackageArg);
await this.log(smartlogPackageArg);
},
};
}