Commit 1a82f05a authored by Jordan Sissel's avatar Jordan Sissel

Merge pull request #81 from avleen/master

Add option to read new files from the top (Useful for testing or backfill)
parents 5bb450f8 548f8980
......@@ -105,6 +105,8 @@ func (h *Harvester) open() *os.File {
// TODO(sissel): Only seek if the file is a file, not a pipe or socket.
if h.Offset > 0 {
h.file.Seek(h.Offset, os.SEEK_SET)
} else if *from_beginning {
h.file.Seek(0, os.SEEK_SET)
} else {
h.file.Seek(0, os.SEEK_END)
}
......
......@@ -14,6 +14,7 @@ var spool_size = flag.Uint64("spool-size", 1024, "Maximum number of events to sp
var idle_timeout = flag.Duration("idle-flush-time", 5 * time.Second, "Maximum time to wait for a full spool before flushing anyway")
var config_file = flag.String("config", "", "The config file to load")
var use_syslog = flag.Bool("log-to-syslog", false, "Log to syslog instead of stdout")
var from_beginning = flag.Bool("from-beginning", false, "Read new files from the beginning, instead of the end")
func main() {
flag.Parse()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment