Documentation ¶
Index ¶
Constants ¶
const ( LOG_EMERG = 0 LOG_ALERT = 1 LOG_CRIT = 2 LOG_ERR = 3 LOG_WARNING = 4 LOG_NOTICE = 5 LOG_INFO = 6 LOG_DEBUG = 7 )
Syslog severity levels
const ( DefaultMaxReconnect = 3 DefaultReconnectDelay = 1 )
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
What compression type the writer should use when sending messages to the graylog2 server
const ( CompressGzip CompressType = iota CompressZlib CompressNone )
type GelfWriter ¶
type GelfWriter struct { Extra map[string]interface{} Facility string // defaults to current process name // 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 (*GelfWriter) Close ¶
func (w *GelfWriter) Close() error
Close connection and interrupt blocked Read or Write operations
type Message ¶
type Message struct { Version string `json:"version"` Host string `json:"host"` Short string `json:"short_message"` Full string `json:"full_message,omitempty"` TimeUnix float64 `json:"timestamp"` Level int32 `json:"level,omitempty"` Facility string `json:"facility,omitempty"` Extra map[string]interface{} `json:"-"` RawExtra json.RawMessage `json:"-"` }
Message represents the contents of the GELF message. It is gzipped before sending.
func (*Message) UnmarshalJSON ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) ReadMessage ¶
type TCPWriter ¶
type TCPWriter struct { GelfWriter MaxReconnect int ReconnectDelay time.Duration // contains filtered or unexported fields }
func NewTCPWriter ¶
func (*TCPWriter) 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.
type UDPWriter ¶
type UDPWriter struct { GelfWriter CompressionLevel int // one of the consts from compress/flate CompressionType CompressType }
func NewUDPWriter ¶
New 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 (*UDPWriter) Write ¶
Write encodes the given string in a GELF message and sends it to the server specified in New().
func (*UDPWriter) 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.