hpcloud / tail

Go package for reading from continously updated files (tail -f)
MIT License
2.7k stars 502 forks source link

lost logs when log rotated #154

Open zhengxiaochuan-3 opened 5 years ago

zhengxiaochuan-3 commented 5 years ago
    tailer, err := tail.TailFile(podLogPath, tail.Config{
        ReOpen:      true,
        MustExist:   true,
        Follow:      true,
        Poll:        true,
        Logger:      tail.DiscardingLogger,
        RateLimiter: lp.limiter,
        Location:    &tail.SeekInfo{0, 2},
    })

When log file being writed very fast , and rotated , will lose logs . what I'm missed ?

mohammed90 commented 5 years ago

I'm not sure about the internals of this library, but... I think this lightening talk by Bryan Cantrill is relevant.

zhengxiaochuan-3 commented 5 years ago

Change POLL_DURATION from 250 * time.Millisecond to 2*time.Millisecond helpful.