fix(core): update
This commit is contained in:
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@mojoio/elasticsearch',
|
||||
version: '1.0.31',
|
||||
description: 'log to elasticsearch in a kibana compatible format'
|
||||
}
|
@ -21,7 +21,7 @@ export class ElasticIndex {
|
||||
this.elasticSearchRef.client.cat.indices(
|
||||
{
|
||||
format: 'json',
|
||||
bytes: 'm'
|
||||
bytes: 'm',
|
||||
},
|
||||
async (err, responseArg: any[]) => {
|
||||
if (err) {
|
||||
@ -31,10 +31,10 @@ export class ElasticIndex {
|
||||
|
||||
// lets delete indexes that violate the retention
|
||||
if (Array.isArray(responseArg)) {
|
||||
const filteredIndices = responseArg.filter(indexObjectArg => {
|
||||
const filteredIndices = responseArg.filter((indexObjectArg) => {
|
||||
return indexObjectArg.index.startsWith('smartlog');
|
||||
});
|
||||
const filteredIndexNames = filteredIndices.map(indexObjectArg => {
|
||||
const filteredIndexNames = filteredIndices.map((indexObjectArg) => {
|
||||
return indexObjectArg.index;
|
||||
});
|
||||
this.deleteOldIndices(filteredIndexNames);
|
||||
@ -43,7 +43,7 @@ export class ElasticIndex {
|
||||
let index = null;
|
||||
|
||||
if (Array.isArray(responseArg)) {
|
||||
index = responseArg.find(indexObject => {
|
||||
index = responseArg.find((indexObject) => {
|
||||
return indexObject.index === indexArg;
|
||||
});
|
||||
}
|
||||
@ -53,7 +53,7 @@ export class ElasticIndex {
|
||||
this.elasticSearchRef.client.indices.create(
|
||||
{
|
||||
waitForActiveShards: '1',
|
||||
index: indexArg
|
||||
index: indexArg,
|
||||
},
|
||||
(error, response) => {
|
||||
// console.lof(response)
|
||||
@ -86,7 +86,7 @@ export class ElasticIndex {
|
||||
const done2 = plugins.smartpromise.defer();
|
||||
this.elasticSearchRef.client.indices.delete(
|
||||
{
|
||||
index: indexName
|
||||
index: indexName,
|
||||
},
|
||||
(err2, response2) => {
|
||||
if (err2) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ElasticSearch, IStandardLogParams } from './elasticsearch.classes.elasticsearch';
|
||||
import { ElasticSearch, type IStandardLogParams } from './elasticsearch.classes.elasticsearch.js';
|
||||
|
||||
export class ElasticScheduler {
|
||||
elasticSearchRef: ElasticSearch<any>;
|
||||
|
@ -1,10 +1,10 @@
|
||||
// interfaces
|
||||
import { Client as ElasticClient } from 'elasticsearch';
|
||||
import { ILogContext, ILogPackage, ILogDestination } from '@pushrocks/smartlog-interfaces';
|
||||
import type { ILogContext, ILogPackage, ILogDestination } from '@pushrocks/smartlog-interfaces';
|
||||
|
||||
// other classes
|
||||
import { ElasticScheduler } from './elasticsearch.classes.elasticscheduler';
|
||||
import { ElasticIndex } from './elasticsearch.classes.elasticindex';
|
||||
import { ElasticScheduler } from './elasticsearch.classes.elasticscheduler.js';
|
||||
import { ElasticIndex } from './elasticsearch.classes.elasticindex.js';
|
||||
|
||||
export interface IStandardLogParams {
|
||||
message: string;
|
||||
@ -35,7 +35,7 @@ export class ElasticSearch<T> {
|
||||
*/
|
||||
constructor(optionsArg: IElasticSearchConstructorOptions) {
|
||||
this.client = new ElasticClient({
|
||||
host: this.computeHostString(optionsArg)
|
||||
host: this.computeHostString(optionsArg),
|
||||
// log: 'trace'
|
||||
});
|
||||
this.indexPrefix = optionsArg.indexPrefix;
|
||||
@ -80,8 +80,8 @@ export class ElasticSearch<T> {
|
||||
type: 'log',
|
||||
body: {
|
||||
'@timestamp': new Date(logPackageArg.timestamp).toISOString(),
|
||||
...logPackageArg
|
||||
}
|
||||
...logPackageArg,
|
||||
},
|
||||
},
|
||||
(error, response) => {
|
||||
if (error) {
|
||||
@ -97,9 +97,9 @@ export class ElasticSearch<T> {
|
||||
|
||||
get logDestination(): ILogDestination {
|
||||
return {
|
||||
handleLog: (smartlogPackageArg: ILogPackage) => {
|
||||
handleLog: async (smartlogPackageArg: ILogPackage) => {
|
||||
this.log(smartlogPackageArg);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export * from './elasticsearch.classes.elasticsearch';
|
||||
export * from './elasticsearch.classes.elasticsearch.js';
|
||||
|
Reference in New Issue
Block a user