Socket
Socket
Sign inDemoInstall

log4js-stackdriver-appender

Package Overview
Dependencies
146
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    log4js-stackdriver-appender

a log4js appender to use with google cloude logging stackdriver api


Version published
Weekly downloads
18
decreased by-45.45%
Maintainers
1
Install size
59.3 MB
Created
Weekly downloads
 

Readme

Source

log4js-stackdriver-appender

a log4js appender for use with the stackdriver on google cloud.

to allow access to google cloud logging please follow setup and access permission on google cloud documentation. You can use Application Default Credentials (ADC) or supply credential in config.

if your code is running on Google Cloud then make sure the proper scopes is setup.

if you running on you local dev server , use gcloud cli to authorize.

By default all logging will be done to file syslog in the "Global" logging section.

If you want you can specify a resource which the log will be written to.

quick usage

var config ={
    appenders: {
        google: {
            type:  'log4js-stackdriver-appender',
            resource: {
                type: "container",
                labels: {
                    cluster_name: 'local-dev',
                    pod_id: process.env["HOSTNAME"],
                    container_name: ''
                }
            },
            logFileName: 'syslog',
            layout: {
                type: 'basic'
            }
        }
    },
    categories: {
        default: {
            appenders: ['google'],
            level:'DEBUG'
        }
    }
};

var log4js = require('log4js');
log4js.configure(config);
var logger = log4js.getLogger('local');
logger.debug('somthing');

if you are running from local/not on GCP you can supply credentials in the config for connecting to your GCP

var config ={
    appenders:{
        google:{
            type: 'log4js-stackdriver-appender',
            credentials:{
                projectId: 'your-project-id',
                keyFilename: '/path/to/key.json'
            }
        }
    }
}

install

npm install log4js-stackdriver-appender --save

Keywords

FAQs

Last updated on 05 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc