diff --git a/REFERENCE.md b/REFERENCE.md
index b7ca170..d22e593 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -84,6 +84,7 @@ The following parameters are available in the `fluentbit` class:
* [`grace`](#-fluentbit--grace)
* [`daemon`](#-fluentbit--daemon)
* [`dns_mode`](#-fluentbit--dns_mode)
+* [`log_file`](#-fluentbit--log_file)
* [`log_level`](#-fluentbit--log_level)
* [`http_server`](#-fluentbit--http_server)
* [`http_listen`](#-fluentbit--http_listen)
@@ -361,6 +362,14 @@ Data type: `Enum['UDP', 'TCP']`
Sets the primary transport layer protocol used by the asynchronous DNS resolver.
+##### `log_file`
+
+Data type: `Optional[Stdlib::Absolutepath]`
+
+Absolute path where Fluent Bit will write its diagnostic logs.
+When specified, logs go to this file instead of syslog.
+The file will be created by Fluent Bit automatically.
+
##### `log_level`
Data type: `Fluentbit::Loglevel`
diff --git a/manifests/config.pp b/manifests/config.pp
index f7219d0..ec6cebc 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -132,6 +132,12 @@
'hc.period' => $fluentbit::hc_period,
},
}
+ $log_file_config = $fluentbit::log_file ? {
+ undef => {},
+ default => {
+ 'log_file' => $fluentbit::log_file,
+ },
+ }
$service_config = {
'flush' => $fluentbit::flush,
@@ -146,7 +152,7 @@
'scheduler.cap' => $fluentbit::scheduler_cap,
'scheduler.base' => $fluentbit::scheduler_base,
'json.convert_nan_to_null' => $fluentbit::json_convert_nan_to_null,
- } + $storage_config + $health_config
+ } + $storage_config + $health_config + $log_file_config
if $fluentbit::format == 'classic' {
$config_content = epp('fluentbit/fluentbit.conf.epp',
diff --git a/manifests/init.pp b/manifests/init.pp
index f5347fe..8274f1a 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -193,9 +193,11 @@
# Boolean value to set if Fluent Bit should run as a Daemon (background) or not. Allowed values are: yes, no, on and off.
# @param dns_mode
# Sets the primary transport layer protocol used by the asynchronous DNS resolver.
+# @param log_file
+# Specify the absolute path to the log file for Fuent Bit service itself
# @param log_level
# Set the logging verbosity level.
-# Values are: error, info, debug and trace. Values are accumulative,
+# Values are: off, error, warn, info, debug and trace. Values are accumulative,
# e.g: if 'debug' is set, it will include error, info and debug.
# Note that trace mode is only available if Fluent Bit was built with the WITH_TRACE option enabled.
# @param http_server
@@ -298,6 +300,7 @@
Fluentbit::Stream $streams = {},
Array[Stdlib::Absolutepath] $plugins = [],
Optional[String[1]] $memory_max = undef,
+ Optional[Stdlib::Absolutepath] $log_file = undef,
Array[Stdlib::Absolutepath] $includes = [],
) {
$pipelines_path = "${config_dir}/${pipelines_dir}"
diff --git a/templates/fluentbit.conf.epp b/templates/fluentbit.conf.epp
index 97d25f3..0147cb8 100644
--- a/templates/fluentbit.conf.epp
+++ b/templates/fluentbit.conf.epp
@@ -9,6 +9,9 @@
Grace <%= $service['grace'] %>
dns.mode <%= $service['dns.mode'] %>
Log_Level <%= $service['log_level'] %>
+<% if $service['log_file'] { %>
+ Log_File <%= $service['log_file'] %>
+<% } -%>
parsers_file <%= $service['parsers_file'] %>
plugins_file <%= $service['plugins_file'] %>
streams_file <%= $service['streams_file'] %>
diff --git a/types/loglevel.pp b/types/loglevel.pp
index a3abc9f..c9f0e29 100644
--- a/types/loglevel.pp
+++ b/types/loglevel.pp
@@ -1 +1 @@
-type Fluentbit::Loglevel = Enum['error', 'warning', 'info', 'debug', 'trace']
+type Fluentbit::Loglevel = Enum['error', 'warn', 'info', 'debug', 'trace', 'off']