Module: Fluent::FluentSigdump

Defined in:
lib/fluent/supervisor.rb

Class Method Summary collapse

Class Method Details

.dump_windowsObject



1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
# File 'lib/fluent/supervisor.rb', line 1130

def self.dump_windows
  raise "[BUG] WindowsSigdump::dump is for Windows ONLY." unless Fluent.windows?

  # Sigdump outputs under `/tmp` dir without `SIGDUMP_PATH` specified,
  # but `/tmp` dir may not exist on Windows by default.
  # So use the systemroot-temp-dir instead.
  dump_filepath = ENV['SIGDUMP_PATH'].nil? || ENV['SIGDUMP_PATH'].empty? \
    ? "#{ENV['windir']}/Temp/fluentd-sigdump-#{Process.pid}.log"
    : get_path_with_pid(ENV['SIGDUMP_PATH'])

  require 'sigdump'
  Sigdump.dump(dump_filepath)

  $log.info "dump to #{dump_filepath}."
end

.get_path_with_pid(raw_path) ⇒ Object



1146
1147
1148
1149
# File 'lib/fluent/supervisor.rb', line 1146

def self.get_path_with_pid(raw_path)
  path = Pathname.new(raw_path)
  path.sub_ext("-#{Process.pid}#{path.extname}").to_s
end