Documentation
¶
Index ¶
- Constants
- Variables
- func BufferedTailerWithMetrics(orig tailer.Tailer) tailer.Tailer
- func RunHttpServer(host string, port int, path string, handler http.Handler) error
- func RunHttpsServer(host string, port int, cert, key, path string, handler http.Handler) error
- func RunHttpsServerWithDefaultKeys(host string, port int, path string, handler http.Handler) error
- func VerifyFieldNames(m *v2.MetricConfig, regex *OnigurumaRegexp) error
- func VersionString() string
- type Metric
- type OnigurumaLib
- type OnigurumaMatchResult
- type OnigurumaRegexp
- type Patterns
Constants ¶
const PATTERN_RE = `%{(.+?)}`
PATTERN_RE matches the %{..} patterns. There are three possibilities: 1) %{USER} - grok pattern 2) %{IP:clientip} - grok pattern with name 3) %{INT:clientport:int} - grok pattern with name and type (type is currently ignored)
Variables ¶
var ( Version string BuildDate string Branch string Revision string GoVersion = runtime.Version() Platform = runtime.GOOS + "-" + runtime.GOARCH )
The following strings are populated during build time with release.sh: go build -ldflags "-X importpath.name=value"
var ( // See the #define statements in oniguruma.h ONIG_ENCODING_UTF8 = &C.OnigEncodingUTF8 )
Functions ¶
func BufferedTailerWithMetrics ¶
Wrapper around a tailer that consumes the lines channel quickly. The idea is that the original tailer can continue reading lines from the logfile, and does not need to wait until the lines are processed. The number of buffered lines are exposed as a Prometheus metric, if lines are constantly produced faster than they are consumed, we will eventually run out of memory.
func RunHttpServer ¶
func RunHttpsServer ¶
func VerifyFieldNames ¶
func VerifyFieldNames(m *v2.MetricConfig, regex *OnigurumaRegexp) error
func VersionString ¶
func VersionString() string
Types ¶
type Metric ¶
type Metric interface { Name() string Collector() prometheus.Collector // Returns true if the line matched, and false if the line didn't match. Process(line string) (bool, error) }
func NewCounterMetric ¶
func NewCounterMetric(cfg *v2.MetricConfig, regex *OnigurumaRegexp) Metric
func NewGaugeMetric ¶
func NewGaugeMetric(cfg *v2.MetricConfig, regex *OnigurumaRegexp) Metric
func NewHistogramMetric ¶
func NewHistogramMetric(cfg *v2.MetricConfig, regex *OnigurumaRegexp) Metric
func NewSummaryMetric ¶
func NewSummaryMetric(cfg *v2.MetricConfig, regex *OnigurumaRegexp) Metric
type OnigurumaLib ¶
type OnigurumaLib struct {
// contains filtered or unexported fields
}
func InitOnigurumaLib ¶
func InitOnigurumaLib() (*OnigurumaLib, error)
Warning: The Oniguruma library is not thread save, it should be used in a single thread.
func (*OnigurumaLib) Compile ¶
func (o *OnigurumaLib) Compile(pattern string) (*OnigurumaRegexp, error)
func (*OnigurumaLib) Version ¶
func (o *OnigurumaLib) Version() string
type OnigurumaMatchResult ¶
type OnigurumaMatchResult struct {
// contains filtered or unexported fields
}
func (*OnigurumaMatchResult) Free ¶
func (m *OnigurumaMatchResult) Free()
func (*OnigurumaMatchResult) IsMatch ¶
func (m *OnigurumaMatchResult) IsMatch() bool
type OnigurumaRegexp ¶
type OnigurumaRegexp struct {
// contains filtered or unexported fields
}
func Compile ¶
func Compile(pattern string, patterns *Patterns, libonig *OnigurumaLib) (*OnigurumaRegexp, error)
Compile a grok pattern string into a regular expression.
func (*OnigurumaRegexp) Free ¶
func (regex *OnigurumaRegexp) Free()
func (*OnigurumaRegexp) HasCaptureGroup ¶
func (regex *OnigurumaRegexp) HasCaptureGroup(name string) bool
func (*OnigurumaRegexp) Match ¶
func (regex *OnigurumaRegexp) Match(input string) (*OnigurumaMatchResult, error)
type Patterns ¶
func InitPatterns ¶
func InitPatterns() *Patterns
func (*Patterns) AddFile ¶
pattern files see https://github.com/logstash-plugins/logstash-patterns-core/tree/master/patterns