All Projects → JaniAnttonen → winston-loki

JaniAnttonen / winston-loki

Licence: MIT License
Grafana Loki transport for the nodejs logging library Winston.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to winston-loki

loki-multi-tenant-proxy
Grafana Loki multi-tenant Proxy. Needed to deploy Grafana Loki in a multi-tenant way
Stars: ✭ 48 (-12.73%)
Mutual labels:  loki, grafana-loki
paStash
pastaʃ'ʃ = Spaghetti I/O Event Data Processing, Interpolation, Correlation and beyond 🍝
Stars: ✭ 89 (+61.82%)
Mutual labels:  loki, grafana-loki
serilog-sinks-grafana-loki
A Serilog sink sending log events to Grafana Loki
Stars: ✭ 55 (+0%)
Mutual labels:  loki
dashflare
🕵🏼‍♀️ Open Source and privacy-focused analytics solution. 📊 Advanced monitoring for your website behind Cloudflare
Stars: ✭ 78 (+41.82%)
Mutual labels:  grafana-loki
winston-slack-webhook-transport
A Slack transport for Winston 3 that logs to a channel via webhooks
Stars: ✭ 21 (-61.82%)
Mutual labels:  winston-transport
YaraStation
Yara station is a management portal for Neo23x0-Loki. The mission is to transform the standalone nature of the Loki scanner into a centralized management solution that facilitates result investigation and easier scanning capabilities.
Stars: ✭ 25 (-54.55%)
Mutual labels:  loki
promtail-client
Promtail client library. Promtail is an agent for Loki logging system.
Stars: ✭ 40 (-27.27%)
Mutual labels:  loki
Loki.Rat
Loki.Rat is a fork of the Ares RAT, it integrates new modules, like recording , lockscreen , and locate options. Loki.Rat is a Python Remote Access Tool.
Stars: ✭ 63 (+14.55%)
Mutual labels:  loki
loki-operator
viaq.github.io/loki-operator/
Stars: ✭ 30 (-45.45%)
Mutual labels:  loki
gimlet-stack
Bootstrap curated Kubernetes stacks. Logging, metrics, ingress and more - delivered with gitops.
Stars: ✭ 12 (-78.18%)
Mutual labels:  loki
dns-collector
Aggregator, analyzer, transporter and logging for your DNS logs
Stars: ✭ 58 (+5.45%)
Mutual labels:  loki
logs-winston
Apex Logs integration for the Node.js Winston logging framework
Stars: ✭ 22 (-60%)
Mutual labels:  winston-transport
docker
Docker containers of elementary OS environments and related tools primarily used in Travis Continuous Integration Automated Testing
Stars: ✭ 18 (-67.27%)
Mutual labels:  loki
Loki
一个轻量级Web蜜罐 - A Little Web Honeypot.🍯🍯🍯🐝🐝🐝
Stars: ✭ 151 (+174.55%)
Mutual labels:  loki
CryptoProfitSwitcher
Extensible profit switcher for crypto coins and algorithms
Stars: ✭ 49 (-10.91%)
Mutual labels:  loki
VictoriaLogs
Loki On VictoriaMetrics
Stars: ✭ 58 (+5.45%)
Mutual labels:  loki
Loki
Like Prometheus, but for logs.
Stars: ✭ 14,483 (+26232.73%)
Mutual labels:  loki
Flink Learning
flink learning blog. http://www.54tianzhisheng.cn/ 含 Flink 入门、概念、原理、实战、性能调优、源码解析等内容。涉及 Flink Connector、Metrics、Library、DataStream API、Table API & SQL 等内容的学习案例,还有 Flink 落地应用的大型项目案例(PVUV、日志存储、百亿数据实时去重、监控告警)分享。欢迎大家支持我的专栏《大数据实时计算引擎 Flink 实战与性能优化》
Stars: ✭ 11,378 (+20587.27%)
Mutual labels:  loki
loki exporter
Prometheus exporter to collect metrics and run queries against the Grafana Loki API.
Stars: ✭ 28 (-49.09%)
Mutual labels:  loki
winston-telegram
A Telegram transport for winston
Stars: ✭ 28 (-49.09%)
Mutual labels:  winston-transport

winston-loki

npm version install size Build Status Coverage Status Maintainability

A Grafana Loki transport for the nodejs logging library Winston.

Usage

This Winston transport is used similarly to other Winston transports. Require winston and define a new LokiTransport() inside its options when creating it.

Examples

Several usage examples with a test configuration for Grafana+Loki+Promtail reside under examples/. If you want the simplest possible configuration, that's probably the place to check out. By defining json: true and giving winston-loki the correct host address for Loki is enough for most.

Options

LokiTransport() takes a Javascript object as an input. These are the options that are available, required in bold:

Parameter Description Example Default
host URL for Grafana Loki http://127.0.0.1:3100 null
interval The interval at which batched logs are sent in seconds 30 5
json Use JSON instead of Protobuf for transport true false
batching If batching is not used, the logs are sent as they come true true
clearOnError Discard any logs that result in an error during transport true false
replaceTimestamp Replace any log timestamps with Date.now() true false
labels custom labels, key-value pairs { module: 'http' } undefined
format winston format (https://github.com/winstonjs/winston#formats) simple() undefined
gracefulShutdown Enable/disable graceful shutdown (wait for any unsent batches) false true
timeout timeout for requests to grafana loki in ms 30000 undefined
basicAuth basic authentication credentials to access Loki over HTTP username:password undefined
onConnectionError Loki error connection handler (err) => console.error(err) undefined

Example

With default formatting:

const { createLogger, transports } = require("winston");
const LokiTransport = require("winston-loki");
const options = {
  ...,
  transports: [
    new LokiTransport({
      host: "http://127.0.0.1:3100"
    })
  ]
  ...
};
const logger = createLogger(options);

You can set custom labels in every log as well like this:

logger.debug({ message: 'test', labels: { 'key': 'value' } })

TODO: Add custom formatting example

Developing

Requirements

Running a local Loki for testing is probably required, and the easiest way to do that is to follow this guide: https://github.com/grafana/loki/tree/master/production#run-locally-using-docker. After that, Grafana Loki instance is available at http://localhost:3100, with a Grafana instance running at http://localhost:3000. Username admin, password admin. Add the Loki source with the URL http://loki:3100, and the explorer should work.

Refer to https://grafana.com/docs/loki/latest/api/ for documentation about the available endpoints, data formats etc.

Example

npm install
npm link
cd ~/your_project
npm link winston-loki
npm install

And you should have a working, requirable winston-loki package under your project's node_modules. After the link has been established, any changes to winston-loki should show on rerun of the software that uses it.

Run tests

npm test

Write new ones under /test

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].