A TypeScript-native gRPC client for sending log entries to Grafana Loki. Version 2.2.0 is the latest stable release, actively maintained by Balena with a moderate release cadence. It wraps Loki's Protobuf API (logproto) for efficient binary transport, supports TLS and connection pooling, and provides a simple streaming interface. Differentiates from HTTP-based clients (e.g., winston-loki, loki-transport-winston) by using gRPC for lower latency and higher throughput, and ships with full TypeScript definitions.
npm install loki-grpc-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a Loki client, push single log entries via stream, and send batch pushes with labels.
Use `createStream` and call `write`/`end` on the returned stream. See migration guide.
Switch your project to ESM or use dynamic import if necessary.
Install `@grpc/grpc-js` and update client options (no more `credentials` needed).
Migrate to `createStream` in v2.x.
Set `GRPC_DEFAULT_SSL_ROOTS_FILE_PATH` or provide custom `channelCredentials` in client options.
Increase `maxStreamBuffer` or implement backpressure handling.
Use `import { LokiClient } from 'loki-grpc-client'` instead of `require`.Check the URL and port. If using TLS, set `tls: false` for plaintext or configure proper certificates.
Update to v2.x and use `createStream` which returns a Writable-like stream.