How to use the logzio-nodejs.createLogger function in logzio-nodejs

To help you get started, we’ve selected a few logzio-nodejs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DFEAGILEDEVOPS / MTC / checkapi / index.js View on Github external
const http = require('http')
const fs = require('fs')
const path = require('path')
var os = require('os')
const machineName = os.hostname()
const processId = process.pid

const azure = require('azure-storage')
const storageService = azure.createTableService()
const storageTargetName = 'completechecks'
const entityGenerator = azure.TableUtilities.entityGenerator
const uuid = require('uuidv4')
const debug = process.env.NODE_ENV !== 'production'
let logger
if (process.env.LOGZ_KEY) {
  logger = require('logzio-nodejs').createLogger({
    token: process.env.LOGZ_KEY,
    host: 'listener.logz.io',
    type: 'wac-spike-mtc'
  })
}

const log = (data) => {
  if (logger) {
    logger.log(data)
  }
}

// grab disk data...
let buildId
try {
  buildId = fs.readFileSync(path.join(__dirname, 'build.txt'))
github Rcomian / bunyan-rotating-file-stream / test / stress.js View on Github external
var RotatingFileStream = require('../index');
var bunyan = require('bunyan');
var uuid = require('uuid');
var mkdirp = require('mkdirp');
var EventEmitter = require('events').EventEmitter;
var logzionodejs = require('logzio-nodejs');
var fs = require('fs');
var async = require('async');
var path = require('path');

var apikey = process.argv[2];

var logzio;

if (apikey && apikey !== 'local') {
    logzio = logzionodejs.createLogger({
        token: apikey,
        type: 'rfs ' + process.version
    });
} else {
    logzio = {log: function() {}};
}

var _ = require('lodash');
var Combinatorics = require('js-combinatorics');

var combinations = {
    level: ['debug', 'info', 'warn', 'error', 'fatal'],
    period: ['1m', '1h', '1d', '1m', ''],
    threshold: [0, 1, 10240, '100k', '1m', '1g'],
    totalFiles: [0, 1, 2, 5, 10, 20],
    totalSize: [0, '100k', '1m', '10m', '100m', '1g'],
github logzio / logzio-azure-serverless / eventHubFunction / SharedCode / mainIndex.js View on Github external
module.exports = function processEventHubMessages(context, eventHubMessages, { enableMetric = false }) {
  const { host, token } = enableMetric ? parserOptions.metrics : parserOptions.logs;

  context.log(`Starting Logz.io Azure function with enableMetrics: ${enableMetric}`);
  context.log(JSON.stringify(eventHubMessages));
  const callBackFunction = getCallBackFunction(context);

  const logzioShipper = logger.createLogger({
    token,
    host,
    type: 'eventHub',
    protocol: 'https',
    internalLogger: context,
    compress: true,
    debug: true,
    callback: callBackFunction,
  });

  const dataParser = new DataParser({
    internalLogger: context,
    enableMetric,
  });

  const parseMessagesArray = dataParser.parseEventHubLogMessagesToArray(eventHubMessages);
github ayastreb / bandwidth-hero-proxy / src / logger.js View on Github external
const logger = process.env.LOGZIO_TOKEN
  ? require('logzio-nodejs').createLogger({
      token: process.env.LOGZIO_TOKEN,
      host: 'listener.logz.io'
    })
  : console

module.exports = (action, req) => {
  logger.log({
    message: req.params.url,
    action,
    webp: req.params.webp,
    ip: req.ip,
    origin_type: req.params.originType,
    origin_size: req.params.originSize,
    ...req.log
  })
}
github bluzi / travis-buddy / utils / logger.js View on Github external
prettyStdOut.pipe(process.stdout);
const bunyanLogger = bunyan.createLogger({
  name: env,
  streams: [
    {
      level: 'debug',
      type: 'raw',
      stream: prettyStdOut,
    },
  ],
});

let logzIoLogger;

if (process.env.logzIoAccessToken) {
  logzIoLogger = logzIo.createLogger({
    token: process.env.logzIoAccessToken,
    type: 'api',
  });
}

let logdnaLogger;
if (process.env.logdnaApiKey) {
  logdnaLogger = logdna.createLogger(process.env.logdnaApiKey, {
    env,
    hostname: os.hostname(),
    ip: ip.address(),
  });
}

function setLevel(level) {
  switch (level) {
github logzio / logzio-azure-serverless / dist / logs / logzioLogsFunction / core.js View on Github external
module.exports = function processEventHubMessages(context, eventHubMessages, {
  enableMetric = false,
}) {
  const {
    host,
    token,
  } = enableMetric ? getParserOptions().metrics : getParserOptions().logs;
  context.log(`Starting Logz.io Azure function with enableMetrics: ${enableMetric}`);
  context.log(JSON.stringify(eventHubMessages));
  const callBackFunction = getCallBackFunction(context);

  const logzioShipper = logger.createLogger({
    token,
    host,
    type: 'eventHub',
    protocol: 'https',
    internalLogger: context,
    compress: true,
    debug: true,
    callback: callBackFunction,
  });

  const dataParser = new DataParser({
    internalLogger: context,
    enableMetric,
  });

  const parseMessagesArray = dataParser.parseEventHubLogMessagesToArray(eventHubMessages);

logzio-nodejs

A nodejs implementation for sending logs to Logz.IO cloud service Copy of logzio-nodejs

Apache-2.0
Latest version published 5 months ago

Package Health Score

75 / 100
Full package analysis

Popular logzio-nodejs functions