Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
c71cff4011 | |||
75aecdb064 | |||
faf736f353 | |||
dca54899bf | |||
7dac427f00 | |||
e451c38f32 | |||
540e5be2fa | |||
7d29f88356 | |||
9d81f059fe | |||
52cdf6f9fe | |||
1339db1adf | |||
2b42bd59c5 | |||
4cd9ce8510 | |||
cf2620bd41 | |||
1d1a438f8e | |||
aec150a240 |
23382
package-lock.json
generated
23382
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mojoio/logdna",
|
"name": "@mojoio/logdna",
|
||||||
"version": "1.0.29",
|
"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/**/*",
|
||||||
|
18
test/test.ts
18
test/test.ts
@ -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);
|
||||||
|
@ -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(),
|
||||||
|
@ -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,
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user