Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better: Use realpath for logdevice. #17

Merged
merged 3 commits into from
May 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/peastash/outputs/io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ def self.default_io
end

def initialize(file, *args)
if file.is_a?(String)
# Rewrite symlink path to realpath for instance
# /home/app/releases/20190528155050/log/logstash.log -> /home/app/shared/log/logstash.log
# if the symlinked folder gets deleted on further releases, the log rotation will fail with
# a long wait ending with : log rotation inter-process lock failed.
# realpath is called without the filename because it expects the full path to exists
dir = File.realpath(File.dirname(file))
name = File.basename(file)
file = "#{dir}/#{name}"
end
@device = ::Peastash::LogDevice.new(file, *args)
end

Expand Down