tsaikd / gogstash

Logstash like, written in golang
MIT License
644 stars 106 forks source link

Issues with file output #155

Closed helgeolav closed 3 years ago

helgeolav commented 3 years ago

Hi

I have been looking into the file output module and I see some potensial issues. (All line numbers are from outputfile.go.)

  1. When parsing file/dir modes it is decimal parsing but should be parsed as octal? (Line 103 & 108.)
  2. Potensial race condition on access to writers - line 147 & 150. With lots of concurrent traffic we can end up with more than one trying to write to the same file.
  3. Resource leak as files are never closed. If you log using a daily/hourly rotation the old files are still open for writing.

I can try write a fix for these issues if you agree on this being an issue.

tsaikd commented 3 years ago

PR is welcomed. The author Horaci Macias seems inactive at github...lol