Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use pino-socket with pino-syslog? #1142

Closed
bmaupin opened this issue Sep 28, 2021 · 5 comments · Fixed by #1143
Closed

How can I use pino-socket with pino-syslog? #1142

bmaupin opened this issue Sep 28, 2021 · 5 comments · Fixed by #1143
Assignees

Comments

@bmaupin
Copy link

bmaupin commented Sep 28, 2021

I have a test app:

'use strict';

const pino = require('pino');
const transports = pino.transport({
  targets: [
    {
      target: 'pino-syslog',
    },
    {
      target: 'pino-socket',
      options: {
        address: '127.0.0.1',
        port: 5140,
        mode: 'tcp',
      },
    },
  ],
});
const logger = pino(transports);

logger.error('Test message');

When I run it, the syslog-formatted message logs to stdout:

<131>1 2021-09-28T19:15:09Z bmaupin-laptop - 218252 - - {"level":50,"time":1632856509189,"pid":218252,"hostname":"workstation","msg":"Test message"}

And the syslog server instead receives an unformatted log:

$ nc -kl 5140
{"level":50,"time":1632856509189,"pid":218252,"hostname":"workstation","msg":"Test message"}

These are the package versions I'm using:

    "pino": "^7.0.0-rc.7",
    "pino-socket": "^4.0.0",
    "pino-syslog": "github:Eomm/pino-syslog#pino-7",

Thanks!

@mcollina
Copy link
Member

I think we need to change how pino-syslog work with this module. Instead of combining them via unix pipes, we should just add one as the dependency of the other.

Thanks for the feedback!

@jsumners
Copy link
Member

I would say you should be able to chain/compose transports.

@mcollina mcollina reopened this Sep 29, 2021
@mcollina mcollina transferred this issue from pinojs/pino-socket Sep 29, 2021
@mcollina mcollina changed the title How can I use this with pino-syslog? How can I use pino-socket with pino-syslog? Sep 29, 2021
@mcollina mcollina self-assigned this Sep 29, 2021
@mcollina
Copy link
Member

i'll work on this!

@mcollina
Copy link
Member

Here is the first step: pinojs/pino-abstract-transport#25

@github-actions
Copy link

github-actions bot commented Feb 3, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants