Documentation ¶
Index ¶
- func FirstNonWhitespace(bs []byte) (r rune, ok bool)
- func FlattenMonit(r *MonitRequest) (url.Values, int64)
- func HttpRun(httpPort string, msgsOut chan *LineEvent)
- func IsJson(by []byte) bool
- func IsJsonArray(by []byte) bool
- func IsJsonObject(by []byte) bool
- func MakeCustomHandler(msgsOut chan *LineEvent) http.HandlerFunc
- func MakeFileFlattener(filename string, msgChan chan *LineEvent) func(string)
- func MakeMonitHandler(msgsOut chan *LineEvent) http.HandlerFunc
- func MonitParse(data []byte) (url.Values, int64)
- func RunTransforms(parallel int, msgChan chan *LineEvent)
- func StdinPruducer(msgChan chan *LineEvent)
- func TailFile(filename string, config tail.Config, done chan bool, msgChan chan *LineEvent)
- func ToElasticSearch(msgChan chan *LineEvent, esType, esHost, ttl string, ...)
- func ToStdout(msgChan chan *LineEvent, colorize bool)
- func TransformRegister(txform LineTransform)
- func UpdateLogstashIndex()
- type Event
- type GraphiteRunner
- type LineEvent
- type LineTransform
- type MonitBlock
- type MonitCpu
- type MonitINode
- type MonitMemory
- type MonitPlatform
- type MonitRequest
- type MonitServer
- type MonitService
- type NvMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstNonWhitespace ¶
Returns the first non-whitespace rune in the byte slice. Returns false if the input is not valid UTF-8 or the input contains no runes except whitespace. Returns
func FlattenMonit ¶
func FlattenMonit(r *MonitRequest) (url.Values, int64)
takes a monit object struture, and converts to a map[string]interface{} which it serializes to json, to send over a wire
func IsJsonArray ¶
Determines if the bytes is a json array, only looks at prefix
not parsing the entire thing
func IsJsonObject ¶
func MakeCustomHandler ¶
func MakeCustomHandler(msgsOut chan *LineEvent) http.HandlerFunc
func MakeFileFlattener ¶
This formatter reads go files and performs:
- Squashes multiple lines into one (as needed), Tries to squash panics(go) into one line
- Reads out the LineType/Level [DEBUG,INFO,METRIC] into a field
This expects log files in this format
2013-05-25 13:25:32.475 authctx.go:169: [DEBUG] sink Building sink for kafka from factory method
func MakeMonitHandler ¶
func MakeMonitHandler(msgsOut chan *LineEvent) http.HandlerFunc
func MonitParse ¶
accepts a smokr message of monit format, and parses and converts to a name/value pair format
func RunTransforms ¶
just run the transforms
func StdinPruducer ¶
func StdinPruducer(msgChan chan *LineEvent)
sends messages from stdin for consumption
func ToElasticSearch ¶
func ToElasticSearch(msgChan chan *LineEvent, esType, esHost, ttl string, exitIfNoMsgs time.Duration, sendMetrics bool)
read the message channel and send to elastic search Uses the background Bulk Indexor, which has the **Possibility** of losing data if app panic/quits (but is much faster than non-bulk)
@exitIfNoMsgs : Should we panic if we don't see messages after this duration?
func TransformRegister ¶
func TransformRegister(txform LineTransform)
Types ¶
type Event ¶
type Event struct { Source string `json:"@source"` Type string `json:"@type"` Timestamp time.Time `json:"@timestamp"` Message string `json:"@message"` Tags []string `json:"@tags,omitempty"` IndexFields map[string]interface{} `json:"@idx,omitempty"` Fields map[string]interface{} `json:"@fields,omitempty"` Raw *json.RawMessage `json:"jsonfields,omitempty"` // contains filtered or unexported fields }
A Logstash formatted event
func NewTsEvent ¶
New event using existing time stamp
type GraphiteRunner ¶
func NewGraphiteRunner ¶
func NewGraphiteRunner(addr string) *GraphiteRunner
func (*GraphiteRunner) Close ¶
func (g *GraphiteRunner) Close()
type LineEvent ¶
type LineEvent struct { Data []byte Prefix string Ts time.Time // Date string if found LogLevel string // [METRIC, INFO, DEBUG] Source string // Source = filename if file, else monit, etc Offset uint64 Item interface{} WriteErrs uint16 }
Representing data about a log line from file we are tailing
type LineTransform ¶
func FileFormatter ¶
func FileFormatter(logstashType string, tags []string) LineTransform
file format [date source jsonmessage] parser
func FluentdFormatter ¶
func FluentdFormatter(logstashType string, tags []string) LineTransform
Fluentd format [date source jsonmessage] parser
func GraphiteTransform ¶
func GraphiteTransform(logstashType, addr, prefix string, metricsToEs bool) LineTransform
type MonitBlock ¶
type MonitBlock struct { Percent float32 `xml:"percent"` Usage string `xml:"usage"` Total string `xml:"total"` }
<block>
<percent>57.5</percent> <usage>2051.3 MB</usage> <total>37544.3 MB</total>
</block>
func (*MonitBlock) PercentTotalStr ¶
func (m *MonitBlock) PercentTotalStr() string
type MonitCpu ¶
func (*MonitCpu) PercentTotalStr ¶
type MonitINode ¶
type MonitINode struct { Percent float32 `xml:"percent"` Usage float32 `xml:"usage"` Total float32 `xml:"total"` }
<inode>
<percent>57.5</percent> <usage>36786.6</usage> <total>70127.3</total>
</inode>
func (*MonitINode) PercentTotalStr ¶
func (m *MonitINode) PercentTotalStr() string
type MonitMemory ¶
type MonitMemory struct { Percent float32 `xml:"percent"` PercentTotal float32 `xml:"percenttotal"` Kilobyte int `xml:"kilobyte"` KilobyteTotal int `xml:"kilobytetotal"` }
func (*MonitMemory) PercentTotalStr ¶
func (m *MonitMemory) PercentTotalStr() string
type MonitPlatform ¶
type MonitRequest ¶
type MonitRequest struct { Id int `xml:"id,attr"` Incarnation string `xml:"incarnation,attr"` Version string `xml:"version,attr"` Server MonitServer `xml:"server"` Platform MonitPlatform `xml:"platform"` Services []MonitService `xml:"services>service"` ServiceGroups interface{} `xml:"servicegroups"` }
type MonitServer ¶
type MonitService ¶
type MonitService struct { Type int `xml:"type"` // 0 = filesystem, 3 = service, 5= System(os) Name string `xml:"name,attr"` Ts int `xml:"collected_sec"` Tsu int `xml:"collected_usec"` Status int `xml:"status"` Memory MonitMemory `xml:"memory"` Cpu MonitCpu `xml:"cpu"` Block MonitBlock `xml:"block"` INode MonitINode `xml:"inode"` }