lumbermill: Index | Examples | Files

package lpx

import ""


package main

import (

func main() {
    h := func(w http.ResponseWriter, r *http.Request) {
        lp := lpx.NewReader(bufio.NewReader(r.Body))
        for lp.Next() {
            if string(lp.Header().Name) == "router" {
    http.HandleFunc("/drain", h)
    _ = http.ListenAndServe(":8080", nil)

func decodeMsg(b []byte) {
    // process b



Package Files


type BytesReader Uses

type BytesReader interface {
    ReadBytes(delim byte) (line []byte, err error)
type Header struct {
    PrivalVersion []byte
    Time          []byte
    Hostname      []byte
    Name          []byte
    Procid        []byte
    Msgid         []byte

A Header represents a single header in a logplex entry. All fields are popluated.

type Reader Uses

type Reader struct {
    // contains filtered or unexported fields

A Reader provides sequential access to logplex packages. The Next method advances to the next entry (including the first), and then can be treated as an io.Reader to access the packages payload.

func NewReader Uses

func NewReader(r BytesReader) *Reader

NewReader creates a new Reader reading from r.

func (*Reader) Bytes Uses

func (r *Reader) Bytes() []byte

Bytes returns the message body.

func (*Reader) Err Uses

func (r *Reader) Err() error

Err returns the first non-EOF error that was encountered by the Reader.

func (*Reader) Header Uses

func (r *Reader) Header() *Header

Header returns the current entries decoded header.

func (*Reader) Next Uses

func (r *Reader) Next() bool

Next advances to the next entry in the stream.

Package lpx imports 3 packages (graph) and is imported by 1 packages. Updated 2016-07-16. Refresh now. Tools for package owners.