log4js-node-yandex-cloud-logging
v1.0.4
Published
Yandex Cloud Logging Appender for log4js-node
Downloads
6
Maintainers
Readme
Yandex Cloud Logging Appender for Log4JS
Sends logging events to Yandex Cloud Logging. This appender uses @yandex-cloud/nodejs-sdk. If you want more information on the configuration options below.
Installation
npm install log4js-node-yandex-cloud-logging
(This is a plug-in appender for log4js, so you'll need that as well)
Configuration
type
-log4js-node-yandex-cloud-logging
serviceAccountID
-string
- id of your service accountkeyID
-string
- id of your auth keykeyData
-string
- content of your private keydestination
-string
- destination group idtimeout
-number
(optional) - queue flush timeout in millisecondresourceId
-string
(optional) - resource idsetCategoryAsResourceType
-boolean
(optional) - sets resource type from category name, if false, resourceId required
Example
log4js.configure({
appenders: {
yandexCloudLogging: {
type: 'log4js-node-yandex-cloud-logging',
serviceAccountID: "someServiceAccoutID",
keyID: "someKeyID",
keyData: String(fs.readFileSync("privateKey.pem")),
destination: "someDestination"
}
},
categories: {
default: { appenders: ['yandexCloudLogging'], level: 'info' }
}
});
const logger = log4js.getLogger();
logger.info('Some message');