mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- write File::Tail::Since state per file to ~/.rb_since_d/uid.filepath
This relieves contention for the single ~/.rb_since file Also try to write to /var/run/rb_since/uid.filepath first, if we can.
This commit is contained in:
parent
c055692ca0
commit
4e9eb6ae28
1 changed files with 11 additions and 3 deletions
|
@ -23,9 +23,17 @@ class File; module Tail;
|
|||
class Since < File::Tail::Logfile
|
||||
attr_accessor :statefile
|
||||
|
||||
def initialize(*args)
|
||||
@statefile = "#{ENV["HOME"]}/.rb_since"
|
||||
super(*args)
|
||||
def initialize(filename)
|
||||
super(filename)
|
||||
statename = "#{Process.uid}.#{filename.gsub(File::SEPARATOR, ",")}"
|
||||
@dir = "/var/run/rb_since/"
|
||||
if !File.writable?(@dir)
|
||||
@dir = "#{ENV["HOME"]}/.rb_since_d"
|
||||
if !File.exists?(@dir)
|
||||
Dir.mkdir(@dir)
|
||||
end
|
||||
end
|
||||
@statefile = "#{@dir}/#{statename}"
|
||||
load_state
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue