Documentation
¶
Index ¶
Constants ¶
const (
ChunkSize = 1420
)
Used to control GELF chunking. Should be less than (MTU - len(UDP header)).
TODO: generate dynamically using Path MTU Discovery?
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompressType ¶
type CompressType int
CompressType describes What compression type the writer should use when sending messages to the graylog2 server
const ( //CompressGzip is the gzip compression type CompressGzip CompressType = iota //CompressZlib is the zlib compression type CompressZlib )
type Message ¶
type Message struct { Version string `json:"version"` Host string `json:"host"` Short string `json:"short_message"` Full string `json:"full_message"` TimeUnix int64 `json:"timestamp"` Level int32 `json:"level"` Facility string `json:"facility"` File string `json:"file"` Line int `json:"line"` Extra map[string]interface{} `json:"-"` }
Message represents the contents of the GELF message. It is gzipped before sending.
func (*Message) MarshalJSON ¶
MarshalJSON marshals the Message as JSON
func (*Message) UnmarshalJSON ¶
UnmarshalJSON unmarshals the JSON data into the Message
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps the net connection as an io.Reader
func (*Reader) Read ¶
Read implements the io.Reader interface FIXME: this will discard data if p isn't big enough to hold the full message.
func (*Reader) ReadMessage ¶
ReadMessage reads a message
type Writer ¶
type Writer struct { Facility string // defaults to current process name CompressionLevel int // one of the consts from compress/flate CompressionType CompressType // contains filtered or unexported fields }
Writer implements io.Writer and is used to send both discrete messages to a graylog2 server, or data from a stream-oriented interface (like the functions in log).
func NewWriter ¶
NewWriter returns a new GELF Writer. This writer can be used to send the output of the standard Go log functions to a central GELF server by passing it to log.SetOutput()
func (*Writer) Write ¶
Write encodes the given string in a GELF message and sends it to the server specified in New().
func (*Writer) WriteMessage ¶
WriteMessage sends the specified message to the GELF server specified in the call to New(). It assumes all the fields are filled out appropriately. In general, clients will want to use Write, rather than WriteMessage.