Elogrus
Logrus Hook for ElasticSearch
Install / Use
/learn @sohlich/ElogrusREADME
ElasticSearch Hook for Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/>
<img src="https://travis-ci.org/sohlich/elogrus.svg?branch=master" />Releases
Notice that the master branch always refers to the latest version of Elastic. If you want to use stable versions of elogus, you should use the packages released via gopkg.in.
Here's the version matrix:
ElasticSearch version | Elastic version | Package URL | Remarks |
----------------------|------------------|------------------------------------------|---------|
7.x | 7.0 | gopkg.in/sohlich/elogrus.v7| Use Go modules.
6.x | 6.0 | gopkg.in/sohlich/elogrus.v3| Actively maintained.
5.x | 5.0 | gopkg.in/sohlich/elogrus.v2| Actively maintained.
2.x | 3.0 | gopkg.in/sohlich/elogrus.v1| Deprecated. Please update.
For elastic search 7.x
# We name v7 to align with elastic v7
go get gopkg.in/sohlich/elogrus.v7
go get github.com/olivere/elastic/v7
For elastic search 6.x
go get gopkg.in/sohlich/elogrus.v3
go get github.com/olivere/elastic
For elastic search 5.x
go get gopkg.in/sohlich/elogrus.v2
go get gopkg.in/olivere/elastic.v5
Changelog
- elastic 7.x support (currently in master)
Usage
package main
import (
"github.com/olivere/elastic/v7"
"github.com/sirupsen/logrus"
"gopkg.in/sohlich/elogrus.v7"
)
func main() {
log := logrus.New()
client, err := elastic.NewClient(elastic.SetURL("http://localhost:9200"))
if err != nil {
log.Panic(err)
}
hook, err := elogrus.NewAsyncElasticHook(client, "localhost", logrus.DebugLevel, "mylog")
if err != nil {
log.Panic(err)
}
log.Hooks.Add(hook)
log.WithFields(logrus.Fields{
"name": "joe",
"age": 42,
}).Error("Hello world!")
}
Asynchronous hook
...
elogrus.NewAsyncElasticHook(client, "localhost", logrus.DebugLevel, "mylog")
...
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
349.2kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
