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

Added --umask command line parameter #3671

Merged
merged 1 commit into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
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
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