Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/exporter-logs-otlp-grpc

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/exporter-logs-otlp-grpc

OpenTelemetry Collector Exporter allows user to send collected log records to the OpenTelemetry Collector

  • 0.55.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
770K
increased by1.94%
Maintainers
3
Weekly downloads
 
Created

What is @opentelemetry/exporter-logs-otlp-grpc?

@opentelemetry/exporter-logs-otlp-grpc is an npm package that allows you to export logs using the OpenTelemetry Protocol (OTLP) over gRPC. This package is part of the OpenTelemetry project, which provides a set of APIs, libraries, agents, and instrumentation to enable observability for cloud-native software. The package is specifically designed to handle the export of log data to an OTLP collector or backend.

What are @opentelemetry/exporter-logs-otlp-grpc's main functionalities?

Exporting Logs

This code sample demonstrates how to set up and use the @opentelemetry/exporter-logs-otlp-grpc package to export logs. It includes setting up a diagnostic logger, creating a resource, setting up a logger provider, creating an OTLP log exporter, adding a log record processor, and emitting a log.

const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');
const { Resource } = require('@opentelemetry/resources');
const { SimpleLogRecordProcessor, LoggerProvider } = require('@opentelemetry/sdk-logs');
const { OTLPLogExporter } = require('@opentelemetry/exporter-logs-otlp-grpc');

// Set up diagnostic logger
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);

// Create a resource
const resource = new Resource({
  'service.name': 'my-service',
});

// Create a logger provider
const loggerProvider = new LoggerProvider({
  resource: resource,
});

// Create an OTLP log exporter
const exporter = new OTLPLogExporter({
  url: 'http://localhost:4317',
});

// Add a simple log record processor
loggerProvider.addLogRecordProcessor(new SimpleLogRecordProcessor(exporter));

// Get a logger
const logger = loggerProvider.getLogger('example-logger');

// Emit a log
logger.emit({
  severityText: 'INFO',
  body: 'This is an example log message',
});

Other packages similar to @opentelemetry/exporter-logs-otlp-grpc

Keywords

FAQs

Package last updated on 18 Nov 2024

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc