nsq

package module
v0.0.0-...-a29eca9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2015 License: MIT Imports: 8 Imported by: 0

README

logspout-nsq

Logspout module to publish logs to a NSQ service

Usage

The recommended way to build this is to clone the logspout repository, and to modify the modules.go to contain only the following lines:

package main

import (
	_ "github.com/gliderlabs/logspout/httpstream"
	_ "github.com/gliderlabs/logspout/routesapi"
	_ "github.com/crazyfacka/logspout-nsq"
)

Issue a simple Docker build command

$ docker build -t <your_name>/logspout-nsq .

Finally you just need to start this new docker container

docker run -t --name="logspout" --volume=/var/run/docker.sock:/tmp/docker.sock <your_name>/logspout-nsq "nsq://<nsq_ipaddr>:<nsq_port>?topic=<topic>&svc=<service>&app=<app_name>"

Memo

Later on the idea is to have all this automated in a neat script/docker file/whatevs :)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNsqAdapter

func NewNsqAdapter(route *router.Route) (router.LogAdapter, error)

NewNsqAdapter custom logspout module

Types

type Data

type Data struct {
	ParentCtx   string `json:"parent_ctx_id"` // TODO: this should not be here
	Service     string `json:"service"`
	Environment string `json:"environment,omitempty"`
	DockerName  string `json:"dockername"`
	HostName    string `json:"hostname"`
	Timestamp   string `json:"timestamp"`
	Severity    string `json:"severity"`
	Application string `json:"application"`
	CallerLine  string `json:"caller_line,omitempty"`
	CallerFile  string `json:"caller_file,omitempty"`
	Message     string `json:"msg"`
}

Data struct, part of the Log message

type Log

type Log struct {
	Meta *Meta `json:"meta"`
	Data *Data `json:"data"`
}

Log struct to hold the message to be sent through NSQ

type Meta

type Meta struct {
	Process string `json:"process_ctx_id"`
	Ctx     string `json:"ctx_id"`
}

Meta struct, part of the Log message

type NsqAdapter

type NsqAdapter struct {
	// contains filtered or unexported fields
}

NsqAdapter struct

func (*NsqAdapter) Stream

func (a *NsqAdapter) Stream(logstream chan *router.Message)

Stream will handle the logging messages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL