8000 GitHub - ic2hrmk/lokigrus: A Promtail hook for Logrus logger · GitHub
[go: up one dir, main page]

Skip to content
ic2hrmkPublic

About

A Promtail hook for Logrus logger

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

!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

About

A Promtail hook for Logrus logger

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0