Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapReduce ¶ added in v1.1.0
Iterate over given file and map each it's line into Entry record using parser and apply reducer to the Entries channel. Execution terminates when result will be readed from reducer's output channel, but the mapper works and fills input Entries channel until all lines will be read from the fiven file.
Types ¶
type Entry ¶
Parsed log record. Use Get method to retrieve a value by name instead of threating this as a map, because inner representation is in design.
type Parser ¶ added in v1.1.0
type Parser struct {
// contains filtered or unexported fields
}
Log record parser. Use specific constructors to initialize it.
func NewNginxParser ¶ added in v1.1.0
NewNginxParser parse nginx conf file to find log_format with given name and returns parser for this format. It returns an error if cannot find the needle.
type ReadAll ¶ added in v1.1.0
type ReadAll struct { }
Implements Reducer interface for simple input entries redirection to the output channel.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Log file reader. Use specific constructors to create it.
func NewNginxReader ¶
func NewNginxReader(logFile io.Reader, nginxConf io.Reader, formatName string) (reader *Reader, err error)
Creates reader for nginx log format. Nginx config parser will be used to get particular format from the conf file.
type Reducer ¶ added in v1.1.0
type Reducer interface {
Reduce(input chan Entry, output chan interface{})
}
Reducer interface for Entries channel redure.
Each Reduce method should accept input channel of Entries, do it's job and the result should be written to the output channel.
It does not return values because usually it runs in a separate goroutine and it is handy to use channel for reduced data retrieval.
Directories
¶
Path | Synopsis |
---|---|
Example program that reads big nginx file from stdin line by line and measure reading time.
|
Example program that reads big nginx file from stdin line by line and measure reading time. |
example
|
|