/lokigrus

A Promtail hook for Logrus logger without retarded formatting labels

Primary LanguageGo

!Promtail hook for Logrus logger

Lokigrus - Promtail hook for Logrus logger Continious Integration (Lint & Unit Test)

An adapter of Promtail client for Grafana's Loki logging server server to be used with Logrus logger (written with love and tests).

Take a look at my Promtail client

Description

It's a log hook that handles log messages and translates it to Loki's messages via Prmtail client.

Current implementation contains:

  • Logrus hook for centralized logging with Grafana Loki server
  • Loki's server health check
  • Report about log exchange failures to logrus logger

How to use

The easiest way is:

package mypackage

import (
    "github.com/ic2hrmk/lokigrus"
    "github.com/sirupsen/logrus"
)

func InitPromtailSupport(
    logger *logrus.Logger,
    lokiAddress string, 
    appLabels map[string]string,
) error {
    promtailHook, err := lokigrus.NewPromtailHook(lokiAddress, appLabels)
    if err != nil {
       return err
    }

    logger.AddHook(promtailHook)

    return nil
}

Issues / Contributing

Feel free to post a Github Issue, I will respond ASAP