Compare commits

..

10 Commits

Author SHA1 Message Date
c71cff4011 1.0.37 2021-07-07 00:53:14 +02:00
75aecdb064 fix(core): update 2021-07-07 00:53:14 +02:00
faf736f353 1.0.36 2021-07-07 00:50:46 +02:00
dca54899bf fix(core): update 2021-07-07 00:50:45 +02:00
7dac427f00 1.0.35 2021-07-07 00:47:45 +02:00
e451c38f32 fix(core): update 2021-07-07 00:47:45 +02:00
540e5be2fa 1.0.34 2020-06-10 08:46:45 +00:00
7d29f88356 fix(core): update 2020-06-10 08:46:44 +00:00
9d81f059fe 1.0.33 2020-06-05 16:06:54 +00:00
52cdf6f9fe fix(core): update 2020-06-05 16:06:52 +00:00
6 changed files with 22420 additions and 1022 deletions

23382
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@mojoio/logdna", "name": "@mojoio/logdna",
"version": "1.0.32", "version": "1.0.37",
"private": false, "private": false,
"description": "an unoffical package for the logdna api", "description": "an unoffical package for the logdna api",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -13,20 +13,20 @@
"format": "(gitzone format)" "format": "(gitzone format)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.24", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.33", "@gitzone/tstest": "^1.0.54",
"@pushrocks/qenv": "^4.0.6", "@pushrocks/qenv": "^4.0.10",
"@pushrocks/tapbundle": "^3.2.1", "@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^14.0.9", "@types/node": "^14.0.11",
"tslint": "^6.1.2", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/lik": "^4.0.13", "@pushrocks/lik": "^4.0.20",
"@pushrocks/smartlog-interfaces": "^2.0.9", "@pushrocks/smartlog-interfaces": "^2.0.22",
"@pushrocks/smartrequest": "^1.1.47", "@pushrocks/smartrequest": "^1.1.52",
"@pushrocks/smartstring": "^3.0.18", "@pushrocks/smartstring": "^3.0.24",
"@pushrocks/taskbuffer": "^2.1.1" "@pushrocks/taskbuffer": "^2.1.13"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

View File

@ -26,6 +26,10 @@ tap.test('should create a standard log message', async () => {
runtime: 'node', runtime: 'node',
zone: 'shipzone' zone: 'shipzone'
}, },
correlation: {
id: '123',
type: 'none'
},
message: 'this is an awesome log message sent by the tapbundle test' message: 'this is an awesome log message sent by the tapbundle test'
}); });
}); });
@ -49,7 +53,11 @@ tap.test('should send in order', async () => {
runtime: 'node', runtime: 'node',
zone: 'shipzone' zone: 'shipzone'
}, },
message: `this is an awesome log message sent by the tapbundle test #${i}` message: `this is an awesome log message sent by the tapbundle test #${i}`,
correlation: {
id: '123',
type: 'none'
}
}; };
testLogDnaAccount.sendSmartlogPackage(testSmartlogMessage); testLogDnaAccount.sendSmartlogPackage(testSmartlogMessage);
i++; i++;
@ -67,6 +75,10 @@ tap.test('should send in order', async () => {
runtime: 'node', runtime: 'node',
zone: 'shipzone' zone: 'shipzone'
}, },
correlation: {
id: '123',
type: 'none'
},
message: `this is an awesome log message sent by the tapbundle test #${i}` message: `this is an awesome log message sent by the tapbundle test #${i}`
}; };
testLogDnaAccount.sendSmartlogPackage(testSmartlogMessage2); testLogDnaAccount.sendSmartlogPackage(testSmartlogMessage2);
@ -83,6 +95,10 @@ tap.test('should send in order', async () => {
runtime: 'node', runtime: 'node',
zone: 'shipzone' zone: 'shipzone'
}, },
correlation: {
id: '123',
type: 'none'
},
message: `this is an awesome log message sent by the tapbundle test #${i}` message: `this is an awesome log message sent by the tapbundle test #${i}`
}; };
testLogDnaAccount.sendSmartlogPackage(testSmartlogMessage3); testLogDnaAccount.sendSmartlogPackage(testSmartlogMessage3);

View File

@ -41,8 +41,9 @@ export class LogAggregator {
private async sendAggregatedLogs(logCandidate: ILogCandidate) { private async sendAggregatedLogs(logCandidate: ILogCandidate) {
this.logObjectMap.remove(logCandidate); this.logObjectMap.remove(logCandidate);
// lets post the message to logdna // lets post the message to logdna
const url = `${this.baseUrl}${logCandidate.urlIdentifier}&now=${Date.now()}`;
const response = await plugins.smartrequest.postJson( const response = await plugins.smartrequest.postJson(
`${this.baseUrl}${logCandidate.urlIdentifier}&now=${Date.now()}`, url,
{ {
headers: { headers: {
Authorization: this.createBasicAuth(), Authorization: this.createBasicAuth(),

View File

@ -71,7 +71,9 @@ export class LogdnaMessage {
line: smartlogPackageArg.message, line: smartlogPackageArg.message,
meta: { meta: {
...smartlogPackageArg.context, ...smartlogPackageArg.context,
logType: smartlogPackageArg.type logType: smartlogPackageArg.type,
correlation: smartlogPackageArg.correlation,
data: smartlogPackageArg.data || {}
}, },
env: smartlogPackageArg.context.environment, env: smartlogPackageArg.context.environment,
hostname: smartlogPackageArg.context.zone, hostname: smartlogPackageArg.context.zone,

View File

@ -31,11 +31,16 @@ export class LogdnaAccount {
const uriIp = euc(lm.options.ip); const uriIp = euc(lm.options.ip);
const uriTags = euc( const uriTags = euc(
(() => { (() => {
let first = true;
return lm.options.tags.reduce((reduced, newItem) => { return lm.options.tags.reduce((reduced, newItem) => {
return `${reduced},${newItem}`; if (first) {
first = false;
reduced = euc(reduced);
}
return `${reduced},${euc(newItem)}`;
}); });
})() })()
); )
// let construct the request uri // let construct the request uri
const requestUrlWithParams = `?hostname=${uriHostname}&mac=${uriMac}&ip=1${uriIp}&tags=${uriTags}`; const requestUrlWithParams = `?hostname=${uriHostname}&mac=${uriMac}&ip=1${uriIp}&tags=${uriTags}`;
@ -64,7 +69,7 @@ export class LogdnaAccount {
*/ */
public get smartlogDestination(): ILogDestination { public get smartlogDestination(): ILogDestination {
return { return {
handleLog: logPackageArg => { handleLog: async logPackageArg => {
this.sendSmartlogPackage(logPackageArg); this.sendSmartlogPackage(logPackageArg);
} }
}; };