Documentation ¶
Index ¶
- Constants
- Variables
- func NewFluentRecordJSON(key string, line []byte) *fluent.TinyFluentRecord
- func NewFluentRecordLTSV(key string, line []byte) *fluent.TinyFluentRecord
- func NewFluentRecordRegexp(key string, line []byte, r *Regexp) *fluent.TinyFluentRecord
- func NewFluentRecordSet(tag, key string, format FileFormat, mod *RecordModifier, reg *Regexp, ...) *fluent.FluentRecordSet
- func Rel2Abs(filename string) (string, error)
- type BoolConverter
- type Config
- type ConfigLogfile
- type ConfigMonitor
- type ConfigReceiver
- type ConfigServer
- type Context
- type ConvertMap
- type ConvertType
- type Converter
- type File
- type FileFormat
- type FileStat
- type FloatConverter
- type InForward
- type InTail
- type IntConverter
- type MessageQueue
- type Monitor
- type OutForward
- type Process
- type ReceiverStat
- type RecordModifier
- type Regexp
- type SentStat
- type ServerStat
- type Signal
- type Stat
- type Stats
- type TimeConverter
- type TimeFormat
- type Watcher
Constants ¶
View Source
const ( DefaultFluentdPort = 24224 DefaultFieldName = "message" DefaultMaxBufferMessages = 1024 * 1024 DefaultTimeKey = "time" )
View Source
const ( OpenRetryInterval = 1 * time.Second SEEK_TAIL = int64(-1) SEEK_HEAD = int64(0) DEBUG = false )
View Source
const ( ConvertTypeString = iota ConvertTypeInt ConvertTypeFloat ConvertTypeBool )
View Source
const ( MessageChannelBufferLen = 1 MonitorChannelBufferLen = 256 LineSeparatorStr = "\n" LTSVColSeparatorStr = "\t" LTSVDataSeparatorStr = ":" StdinFilename = "-" )
View Source
const ( DefaultMonitorPort = 24223 DefaultMonitorHost = "localhost" )
View Source
const (
FlashInterval = 200 * time.Millisecond
)
View Source
const (
TailInterval = 200 * time.Millisecond
)
Variables ¶
View Source
var ( TimeFormatApache = TimeFormat("02/Jan/2006:15:04:05 -0700") TimeFormatNginx = TimeFormat("02/Jan/2006:15:04:05 -0700") TimeFormatSyslog = TimeFormat("Jan 02 15:04:05") TimeFormatUnix = TimeFormat("unix") TimeEpoch = time.Unix(0, 0) )
View Source
var ( RegexpApache = regexp.MustCompile(`^(?P<host>[^ ]*) [^ ]* (?P<user>[^ ]*) \[(?P<time>[^\]]*)\] "(?P<method>\S+)(?: +(?P<path>[^\"]*?)(?: +\S*)?)?" (?P<code>[^ ]*) (?P<size>[^ ]*)(?: "(?P<referer>[^\"]*)" "(?P<agent>[^\"]*)")?$`) RegexpApacheError = regexp.MustCompile(`^\[[^ ]* (?P<time>[^\]]*)\] \[(?P<level>[^\]]*)\](?: \[pid (?P<pid>[^\]]*)\])?( \[client (?P<client>[^\]]*)\])? (?P<message>.*)$`) RegexpNginx = regexp.MustCompile(`^(?P<remote>[^ ]*) (?P<host>[^ ]*) (?P<user>[^ ]*) \[(?P<time>[^\]]*)\] "(?P<method>\S+)(?: +(?P<path>[^\"]*?)(?: +\S*)?)?" (?P<code>[^ ]*) (?P<size>[^ ]*)(?: "(?P<referer>[^\"]*)" "(?P<agent>[^\"]*)")?$`) RegexpSyslog = regexp.MustCompile(`(?P<time>[^ ]*\s*[^ ]* [^ ]*) (?P<host>[^ ]*) (?P<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?P<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?P<message>.*)$`) )
View Source
var DefaultTimeFormat = TimeFormat(time.RFC3339)
View Source
var (
LineSeparator = []byte{'\n'}
)
View Source
var (
ReadBufferSize = 64 * 1024
)
Functions ¶
func NewFluentRecordJSON ¶ added in v0.2.0
func NewFluentRecordJSON(key string, line []byte) *fluent.TinyFluentRecord
func NewFluentRecordLTSV ¶ added in v0.2.0
func NewFluentRecordLTSV(key string, line []byte) *fluent.TinyFluentRecord
func NewFluentRecordRegexp ¶ added in v0.2.0
func NewFluentRecordRegexp(key string, line []byte, r *Regexp) *fluent.TinyFluentRecord
func NewFluentRecordSet ¶
func NewFluentRecordSet(tag, key string, format FileFormat, mod *RecordModifier, reg *Regexp, buffer []byte) *fluent.FluentRecordSet
Types ¶
type BoolConverter ¶ added in v0.1.1
type BoolConverter int
func (BoolConverter) Convert ¶ added in v0.1.1
func (c BoolConverter) Convert(v string) (interface{}, error)
type Config ¶
type Config struct { TagPrefix string FieldName string ReadBufferSize int Servers []*ConfigServer ServerRoundRobin bool Logs []*ConfigLogfile Receiver *ConfigReceiver Monitor *ConfigMonitor SubSecondTime bool }
func NewConfigByArgs ¶
func ReadConfig ¶
type ConfigLogfile ¶
type ConfigLogfile struct { Tag string File string FieldName string Format FileFormat Regexp *Regexp ConvertMap ConvertMap `toml:"Types"` TimeParse bool TimeKey string TimeFormat TimeFormat }
func (*ConfigLogfile) IsStdin ¶ added in v0.2.0
func (cl *ConfigLogfile) IsStdin() bool
func (*ConfigLogfile) Restrict ¶
func (cl *ConfigLogfile) Restrict(c *Config)
type ConfigMonitor ¶ added in v0.0.4
func (*ConfigMonitor) Restrict ¶ added in v0.0.4
func (cr *ConfigMonitor) Restrict(c *Config)
type ConfigReceiver ¶
func (*ConfigReceiver) Restrict ¶
func (cr *ConfigReceiver) Restrict(c *Config)
type ConfigServer ¶
func (*ConfigServer) Address ¶
func (cs *ConfigServer) Address() string
func (*ConfigServer) Restrict ¶
func (cs *ConfigServer) Restrict(c *Config)
type Context ¶ added in v0.2.0
type Context struct { MessageCh chan *fluent.FluentRecordSet MonitorCh chan Stat ControlCh chan interface{} InputProcess sync.WaitGroup OutputProcess sync.WaitGroup StartProcess sync.WaitGroup }
func NewContext ¶ added in v0.2.0
func NewContext() *Context
func (*Context) RunProcess ¶ added in v0.2.0
type ConvertMap ¶ added in v0.0.9
type ConvertMap struct { TypeMap map[string]ConvertType ConverterMap map[string]Converter }
func NewConvertMap ¶ added in v0.0.9
func NewConvertMap(config string) ConvertMap
func (ConvertMap) ConvertTypes ¶ added in v0.1.1
func (c ConvertMap) ConvertTypes(data map[string]interface{})
func (*ConvertMap) UnmarshalText ¶ added in v0.0.9
func (c *ConvertMap) UnmarshalText(text []byte) error
type ConvertType ¶ added in v0.1.4
type ConvertType int
type File ¶
type File struct { *os.File Path string Tag string Position int64 FieldName string FileStat *FileStat Format FileFormat RecordModifier *RecordModifier Regexp *Regexp // contains filtered or unexported fields }
func (*File) UpdateStat ¶ added in v0.0.9
type FileFormat ¶ added in v0.0.9
type FileFormat int
const ( FormatNone FileFormat = iota FormatLTSV FormatJSON FormatRegexp )
func (FileFormat) String ¶ added in v0.0.9
func (i FileFormat) String() string
func (*FileFormat) UnmarshalText ¶ added in v0.0.9
func (f *FileFormat) UnmarshalText(text []byte) error
type FileStat ¶
type FloatConverter ¶ added in v0.1.1
type FloatConverter int
func (FloatConverter) Convert ¶ added in v0.1.1
func (c FloatConverter) Convert(v string) (interface{}, error)
type InForward ¶
func NewInForward ¶
func NewInForward(config *ConfigReceiver) (*InForward, error)
type InTail ¶
type InTail struct {
// contains filtered or unexported fields
}
type IntConverter ¶ added in v0.1.1
type IntConverter int
func (IntConverter) Convert ¶ added in v0.1.1
func (c IntConverter) Convert(v string) (interface{}, error)
type MessageQueue ¶
type MessageQueue struct {
// contains filtered or unexported fields
}
func NewMessageQueue ¶
func NewMessageQueue(maxMessages int) *MessageQueue
func (*MessageQueue) Dequeue ¶
func (q *MessageQueue) Dequeue() (*fluent.FluentRecordSet, bool)
func (*MessageQueue) Enqueue ¶
func (q *MessageQueue) Enqueue(recordSet *fluent.FluentRecordSet) int64
func (*MessageQueue) Len ¶
func (q *MessageQueue) Len() int
type Monitor ¶
func NewMonitor ¶
type OutForward ¶
type OutForward struct { RoundRobin bool // contains filtered or unexported fields }
func NewOutForward ¶
func NewOutForward(configServers []*ConfigServer) (*OutForward, error)
OutForward ... recieve FluentRecordSet from channel, and send it to passed loggers until success.
func (*OutForward) Run ¶
func (f *OutForward) Run(c *Context)
type ReceiverStat ¶ added in v0.0.2
type ReceiverStat struct { Address string `json:"address"` Connections int `json:"-"` TotalConnections int `json:"total_connections"` CurrentConnections int `json:"current_connections"` Messages int64 `json:"messages"` Disposed int64 `json:"disposed"` Buffered int64 `json:"buffered"` MaxBufferMessages int64 `json:"max_buffer_messages"` }
func (*ReceiverStat) ApplyTo ¶ added in v0.0.2
func (s *ReceiverStat) ApplyTo(ss *Stats)
type RecordModifier ¶ added in v0.1.1
type RecordModifier struct {
// contains filtered or unexported fields
}
func (*RecordModifier) Modify ¶ added in v0.1.1
func (m *RecordModifier) Modify(r *fluent.TinyFluentRecord)
type Regexp ¶ added in v0.2.0
func (*Regexp) UnmarshalText ¶ added in v0.2.0
type SentStat ¶
type ServerStat ¶
type ServerStat struct { Index int `json:"-"` Address string `json:"address"` Alive bool `json:"alive"` Error string `json:"error"` }
func (*ServerStat) ApplyTo ¶
func (s *ServerStat) ApplyTo(ss *Stats)
type Stats ¶
type Stats struct { Sent map[string]*SentStat `json:"sent"` Files map[string]*FileStat `json:"files"` Servers []*ServerStat `json:"servers"` Receiver *ReceiverStat `json:"receiver"` // contains filtered or unexported fields }
func (*Stats) WriteJSON ¶
func (ss *Stats) WriteJSON(w http.ResponseWriter)
type TimeConverter ¶ added in v0.1.1
type TimeConverter TimeFormat
type TimeFormat ¶ added in v0.2.0
type TimeFormat string
func (*TimeFormat) UnmarshalText ¶ added in v0.2.0
func (t *TimeFormat) UnmarshalText(text []byte) error
Click to show internal directories.
Click to hide internal directories.