Skip to content

Commit

Permalink
Merge pull request #3671 from syedriko/umask_cli
Browse files Browse the repository at this point in the history
Added --umask command line parameter
  • Loading branch information
ashie authored Mar 16, 2022
2 parents 7779498 + 88a7260 commit 2036c4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/fluent/command/fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
opts[:chgroup] = s
}

opts[:chumask] = 0
op.on('--umask UMASK', "change umask") {|s|
opts[:chumask] = s
}

op.on('-o', '--log PATH', "log file path") {|s|
opts[:log_path] = s
}
Expand Down
6 changes: 4 additions & 2 deletions lib/fluent/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ def self.load_config(path, params = {})
log_path = params['log_path']
chuser = params['chuser']
chgroup = params['chgroup']
chumask = params['chumask']
log_rotate_age = params['log_rotate_age']
log_rotate_size = params['log_rotate_size']

Expand Down Expand Up @@ -436,7 +437,7 @@ def self.load_config(path, params = {})
logger_initializer: logger_initializer,
chuser: chuser,
chgroup: chgroup,
chumask: 0,
chumask: chumask,
suppress_repeated_stacktrace: suppress_repeated_stacktrace,
ignore_repeated_log_interval: ignore_repeated_log_interval,
ignore_same_log_interval: ignore_same_log_interval,
Expand Down Expand Up @@ -603,6 +604,7 @@ def initialize(opt)
@plugin_dirs = opt[:plugin_dirs]
@chgroup = opt[:chgroup]
@chuser = opt[:chuser]
@chumask = opt[:chumask]

@log_rotate_age = opt[:log_rotate_age]
@log_rotate_size = opt[:log_rotate_size]
Expand Down Expand Up @@ -709,7 +711,7 @@ def run_worker
create_socket_manager if @standalone_worker
if @standalone_worker
ServerEngine::Privilege.change(@chuser, @chgroup)
File.umask(0)
File.umask(@chumask.to_i(8))
end
MessagePackFactory.init(enable_time_support: @system_config.enable_msgpack_time_support)
Fluent::Engine.init(@system_config)
Expand Down

0 comments on commit 2036c4a

Please sign in to comment.