GithubHelp home page GithubHelp logo

pino-http-send's People

Contributors

dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pino-http-send's Issues

Be able to use self-signed certificates.

Can we add an option to allow self signed certificates?
We are need to use HTTPS for testing.

Perhaps a new arg like allowInsecureHttps

In send.ts

got(url, {
    method: method as Method,
    ...
    https: {
      rejectUnauthorized: !allowInsecureHttps,
    },
    ...createBody(logs, bodyType as BodyType),
  })
 .option('allowInsecureHttps', {
    alias: 'n',
    type: 'boolean',
    desc: 'if SSL certificates must be verified by a trusted authority',
    group: 'Sending',
    default: false,
  })

pino-http-send - HTTPError: Response code 404 (Not Found)

I'm trying to send logs to and endpoint and optional pass also to the stadout when is needed...

But i'm getting the following error

Screen Shot 2022-01-09 at 8 26 24

See my current config:

....................................................................................................................................................................index.js

"use strict";
// see docs https://github.com/pinojs/pino/blob/master/docs/pretty.md *prod
// https://www.npmjs.com/package/pino-transmit-http/v/1.0.0-alpha.3
// see docs https://github.com/pinojs/pino-pretty *dev
const Hapi = require("@hapi/hapi");
//const {createWriteStream} = require('pino-http-send');
const pino = require('pino');
const hapiPino = require('hapi-pino');
const getResponse = [
  { string: "string1", number: 1, boolean: true },
  { string: "string2", number: 2, boolean: false }
];

async function start() {

  // Create a server with a host and port
  const server = Hapi.server({
    host: "localhost",
    port: 3000,
    debug: false // disable Hapi debug console logging
  });

  // Add the route
  server.route({
    method: "GET",
    path: "/items",
    options: {
      log: { collect: true },
      cache: { expiresIn: 5000 },
      handler: async function (request, h) {
        try {
          // you can also use a pino instance, which will be faster
          request.logger.info('GET_items', getResponse)
          return h.response(getResponse);
        } catch (err) {
          console.log(err);
          return request.logger.error('GET_error', err)
        }
      }
    }
  });

  await server.register({
    plugin: hapiPino,
    options: {
      instance: pino()
      //   {
      //   level: 'info',
      //   stream: createWriteStream({
      //     url: 'http://localhost:3000'
      //   })
      // })
    }
  });

  await server.start();
  server.log(["SERVER_INFO"], `server running: ${server.info.uri}/items`);
  return server;
}

start().catch((err) => {
  console.log(err);
  process.exit(1);
});


....................................................................................................................................................................package.json

{
  "name": "pino-example",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "PINO_HTTP_SEND_url=http://localhost:3000 node . | pino-http-send --url=http://localhost:3000"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@hapi/hapi": "^20.2.1",
    "hapi-pino": "^9.1.0",
    "pino-http-send": "^0.4.2"
  }
}

What i'm missing here? How can i see the logs in some endpoint? Where i can/need to configure that endpoint?

dependecies after install problem (V.0.4.2) / pino (v6.13.3)

Hello Thanks for this awesome lib.
after installing it i'm facing this error (nuxt), any taught ?

 WARN  Compiled with 2 warnings


 WARN  in ./node_modules/yargs/index.js

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted


 WARN  in ./node_modules/yargs/build/lib/apply-extends.js

Critical dependency: the request of a dependency is an expression


 ERROR  Failed to compile with 14 errors

These dependencies were not found:

* dns in ./node_modules/cacheable-lookup/source/index.js
* fs in ./node_modules/got/dist/source/core/index.js, ./node_modules/got/dist/source/core/utils/get-body-size.js and 6 others
* http2 in ./node_modules/http2-wrapper/source/index.js
* net in ./node_modules/got/dist/source/core/utils/timed-out.js, ./node_modules/http2-wrapper/source/utils/calculate-server-name.js
* tls in ./node_modules/http2-wrapper/source/agent.js, ./node_modules/resolve-alpn/index.js
* To install them, you can run: npm install --save dns fs http2 net tls

How to use locally

Does not work when installed locally using npm i pino-http-send
Gives the following error on RHEL7:
bash: pino-http-send: command not found
And the following on Windows:

'pino-http-send' is not recognized as an internal or external command,
operable program or batch file.

The option "log: true" do nothing

I have set the option "log: true" but I get nothing in stdout.

// my logger code
const pino = require('pino');
const { createWriteStream } = require('pino-http-send');

const stream = createWriteStream({
  url: process.env.LOGS_DESTINATION_URL,
  log: true,
  silent: false,
  timeout: 0,
});

const logger = pino(stream);

module.exports = logger;

[feature request] Usage as a module

I don't think this is currently supported, but it would be neat if we could use this library programmatically as a module.

The LogFlare module might be a good starting point on how to do this, but essentially you would want something like:

import { createWriteStream } from 'pino-http-send'

// create stream w/ options
const stream = createWriteStream({
    url: "https://example.com/logging"
});

// create pino loggger
const logger = pino({
    level: 'info
}, stream);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.