Skip to content

Commit 515e351

Browse files
committed
Use relative path in out_file
Signed-off-by: Florian Dobener <[email protected]>
1 parent 2cb45d7 commit 515e351

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/fluent/plugin/out_file.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
require 'fileutils'
1818
require 'zlib'
1919
require 'time'
20+
require 'pathname'
2021

2122
require 'fluent/plugin/output'
2223
require 'fluent/config/error'
@@ -97,7 +98,8 @@ def generate_chunk(metadata)
9798
if chunk.metadata == @latest_metadata
9899
sym_path = @_output_plugin_for_symlink.extract_placeholders(@_symlink_path, chunk)
99100
FileUtils.mkdir_p(File.dirname(sym_path), mode: @_output_plugin_for_symlink.dir_perm)
100-
FileUtils.ln_sf(chunk.path, sym_path)
101+
relative_path = Pathname.new(chunk.path).relative_path_from(Pathname.new(File.dirname(sym_path)))
102+
FileUtils.ln_sf(relative_path, sym_path)
101103
end
102104
chunk
103105
end

0 commit comments

Comments
 (0)