🚀 DAY 3 OF LAUNCH WEEK: Introducing Webhook Events for Pull Request Scans.Learn more →
Socket
Book a DemoInstallSign in
Socket

@openobserve/pino-openobserve

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openobserve/pino-openobserve

Pino transport for Openobserve

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
2
Created
Source

@openobserve/pino-openobserve

This is a transport for the Pino logging library that sends logs to an Openobserve server in batches.

Prerequisites

This package requires Node.js version 18.0.0 or later and pino v7+

Installation

You can install this package using npm or Yarn.

With npm:

npm install @openobserve/pino-openobserve

With Yarn:

yarn add @openobserve/pino-openobserve

Options

The transport accepts an options object with the following properties:

PropertyRequiredDefaultDescription
urlYes-The URL of your Openobserve server.
organizationYes-The name of your organization.
streamNameYes-The name of the stream to which logs should be sent.
authYes{ username: "", password: "" }An object with username and password properties for authenticating with the Openobserve server
batchSizeNo100The number of logs to include in each batch.
timeThresholdNo300000 (5 mins)The interval, in milliseconds, at which logs should be sent.
silentSuccessNofalseA boolean indicating whether to suppress successful operation messages.
silentErrorNofalseA boolean indicating whether to suppress error messages.

Usage

You can use the transport by passing the package name as target, or by importing it directly.

// using require
const pino = require('pino');

// using import
import pino from 'pino';

const logger = pino({
  level: 'info',
  transport: {
    target: '@openobserve/pino-openobserve',
    options: {
      url: 'https://your-openobserve-server.com',
      organization: 'your-organization',
      streamName: 'your-stream',
      auth: {
        username: 'your-username',
        password: 'your-password',
      },
    },
  },
});

logger.info('Hello, world!');
logger.info({ lang: 'js', code: 'Node.js' }, 'Logging with JSON');

Direct import

The way you import the pino and @openobserve/pino-openobserve packages depends on whether you're using import or require.

// using require
const pino = require('pino');
const OpenobserveTransport = require('@openobserve/pino-openobserve').OpenobserveTransport;

// using import
import pino from 'pino';
import { OpenobserveTransport } from '@openobserve/pino-openobserve';

const logger = pino({
  level: 'info',
  transport: {
    target: OpenobserveTransport,
    options: {
      url: 'https://your-openobserve-server.com',
      organization: 'your-organization',
      streamName: 'your-stream',
      auth: {
        username: 'your-username',
        password: 'your-password',
      },
    },
  },
});

logger.info('Hello, world!');
logger.info({ lang: 'js', code: 'Node.js' }, 'Logging with JSON');

In the above examples, the second logger.info call logs a JSON object containing the properties lang and code, along with the message 'Logging with JSON'. This is a common way to include structured data in your logs when using Pino.

License

This package is licensed under the Apache License, Version 2.0. See the LICENSE file for more details.

Keywords

pino

FAQs

Package last updated on 24 Jun 2025

Did you know?

Socket

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