All Projects → rogierlommers → logrus-redis-hook

rogierlommers / logrus-redis-hook

Licence: MIT license
Hook for Logrus which enables logging to RELK stack (Redis, Elasticsearch, Logstash and Kibana)

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to logrus-redis-hook

elk-upgrade
Elastic Stack Upgrade with Ansible
Stars: ✭ 28 (-15.15%)
Mutual labels:  kibana, logstash
awesome-elastic-stack
Awesome Elastic Stack
Stars: ✭ 29 (-12.12%)
Mutual labels:  kibana, logstash
generator-mitosis
A micro-service infrastructure generator based on Yeoman/Chatbot, Kubernetes/Docker Swarm, Traefik, Ansible, Jenkins, Spark, Hadoop, Kafka, etc.
Stars: ✭ 78 (+136.36%)
Mutual labels:  kibana, logstash
aws-elb-logs-to-logstash
Consumes ELB & ALB logs and sends them to logstash for ingestion. Kibana dashboard included.
Stars: ✭ 26 (-21.21%)
Mutual labels:  kibana, logstash
S1EM
This project is a SIEM with SIRP and Threat Intel, all in one.
Stars: ✭ 270 (+718.18%)
Mutual labels:  kibana, logstash
docker grafana statsd elk
Docker repo for a general purpose graphing and logging container - includes graphite+carbon, grafana, statsd, elasticsearch, kibana, nginx, logstash indexer (currently using redis as an intermediary)
Stars: ✭ 19 (-42.42%)
Mutual labels:  kibana, logstash
docker elk stack
Docker images to run an ELK stack
Stars: ✭ 24 (-27.27%)
Mutual labels:  kibana, logstash
tutorials
Tutorials
Stars: ✭ 80 (+142.42%)
Mutual labels:  kibana, logstash
elastic-data-lake
Elastic Data Lake
Stars: ✭ 14 (-57.58%)
Mutual labels:  kibana, logstash
logstash filter f5
A Logstash filter for F5 apd, dcc, sshd and tmm syslog.
Stars: ✭ 19 (-42.42%)
Mutual labels:  kibana, logstash
docker-elk-stack
The ELK stack Docker containerization (Elasticsearch, Logstash and Kibana)
Stars: ✭ 20 (-39.39%)
Mutual labels:  kibana, logstash
dockelk
ELK log transport and aggregation at scale
Stars: ✭ 31 (-6.06%)
Mutual labels:  kibana, logstash
osint-combiner
Combining OSINT sources in Elastic Stack
Stars: ✭ 77 (+133.33%)
Mutual labels:  kibana, logstash
ncedc-earthquakes
The complete set of earthquake data with the Elastic Stack demo.
Stars: ✭ 22 (-33.33%)
Mutual labels:  kibana, logstash
EnterpriseApplicationLog
Enterprise Application Log with RabbitMQ, LogStash, ElasticSearch and Kibana
Stars: ✭ 88 (+166.67%)
Mutual labels:  kibana, logstash
elk-dashboard-v5-docker
My production setup for the latest version of ELK stack running in a compose, displaying a basic -but powerfull- security and performance dashboard.
Stars: ✭ 25 (-24.24%)
Mutual labels:  kibana, logstash
Logrus Logstash Hook
ℹ️ Logstash hook for logrus
Stars: ✭ 150 (+354.55%)
Mutual labels:  hook, logstash
elastic-stack-testing
Elastic Stack Testing Framework (ESTF) 🤖
Stars: ✭ 47 (+42.42%)
Mutual labels:  kibana, logstash
ELK-Hunting
Threat Hunting with ELK Workshop (InfoSecWorld 2017)
Stars: ✭ 58 (+75.76%)
Mutual labels:  kibana, logstash
elk-tls-docker
This repository contains code to create a ELK stack with certificates & security enabled using docker-compose
Stars: ✭ 152 (+360.61%)
Mutual labels:  kibana, logstash

Redis Hook for Logrus :walrus:

Go Report Card

Why?

Useful for centralized logging, using a RELK stack (Redis, Elasticsearch, Logstash and Kibana). When the hook is installed, all log messages are sent to a Redis server, in Logstash message V0 or V1 format, ready to be parsed/processed by Logstash.

Install

$ go get github.com/rogierlommers/logrus-redis-hook

Colored

Usage

package main

import (
	"io/ioutil"

	"github.com/sirupsen/logrus"
	"github.com/rogierlommers/logrus-redis-hook"
)

func init() {
	hookConfig := logredis.HookConfig{
		Host:     "localhost",
		Key:      "my_redis_key",
		Format:   "v0",
		App:      "my_app_name",
		Port:     6379,
		Hostname: "my_app_hostname", // will be sent to field @source_host
		DB:       0, // optional
		TTL:      3600,
	}

	hook, err := logredis.NewHook(hookConfig)
	if err == nil {
		logrus.AddHook(hook)
	} else {
		logrus.Errorf("logredis error: %q", err)
	}
}

func main() {
	// when hook is injected succesfully, logs will be sent to redis server
	logrus.Info("just some info logging...")

	// we also support log.WithFields()
	logrus.WithFields(logrus.Fields{
		"animal": "walrus",
		"foo":    "bar",
		"this":   "that"}).
		Info("additional fields are being logged as well")

	// If you want to disable writing to stdout, use setOutput
	logrus.SetOutput(ioutil.Discard)
	logrus.Info("This will only be sent to Redis")
}

Testing

Please see the docker-compose directory for information about how to test. There is a readme inside.

In case of hook: disable writing to stdout

See this: sirupsen/logrus#328 (comment)

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].