Help us shape the future of Go! Take the 2026 Go Developer Survey

logostash

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

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

Go to latest
Published: Jul 25, 2014 License: MIT Imports: 5 Imported by: 0

README

logostash

Emit logstash JSON events from Golang types.

Usage

First, import the package:

import (
       "github.com/DavidHuie/logostash"
)

Create a client, specifying the type of connection to use and the address of the logstash server:

client, err := logostash.NewClient("udp", "my-logstash-server:8888")

Now, emit any JSON-encodeable type:

message := map[string]string{
	"type":    "my-application",
	"message": "something's f'ed up",
}
err := client.SendJson(message)

Copyright (c) 2014 David Huie. See LICENSE.txt for further details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingConnection = errors.New("Connection is missing")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Conn *net.Conn
}

func NewClient

func NewClient(network, address string) (*Client, error)

func (*Client) SendJson

func (c *Client) SendJson(j interface{}) error

JSON encodes the input struct and sends it to Logstash.

Jump to

Keyboard shortcuts

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