Skip to content

Commit

Permalink
Enable kernel logging to include all facilities in /var/log/messages
Browse files Browse the repository at this point in the history
Differential Revision: D66282632

fbshipit-source-id: adb4f262b7a9b2b1a60d1e3158f54c04dbd670d1
  • Loading branch information
Antony Thomas authored and facebook-github-bot committed Nov 25, 2024
1 parent f303a6b commit a622294
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 17 deletions.
13 changes: 12 additions & 1 deletion cookbooks/fb_syslog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Requirements
Attributes
----------
* node['fb_syslog']['manage_packages']
* node['fb_syslog']['enable_imklog_permitnonkernelfacility']
* node['fb_syslog']['syslog-entries']
* node['fb_syslog']['rsyslog_server']
* node['fb_syslog']['rsyslog_server_address']
Expand Down Expand Up @@ -35,6 +36,17 @@ Usage
This cookbook will install and manage the `rsyslog` package unless the
`node['fb_syslog']['manage_packages]` attribute is set to `false`.

### enable_imklog_permitnonkernelfacility
The `enable_imklog_permitnonkernelfacility` option allows the `imklog` module
to capture logs from non-kernel facilities. By default, `imklog` only
processes logs from the kernel (kernel facility). However, user-space
applications can also write valuable system-level events, such as
reboot events, to the kernel(`/dev/kmsg`). When this option is enabled,
all logs sent to the kernel will be captured by `imklog` and recorded in
`/var/log/messages`.
`false` by default
https://www.rsyslog.com/doc/configuration/modules/imklog.html#permitnonkernelfacility

### syslog-compatible entries
The `node['fb_syslog']['syslog-entries']` is used to populate all lines
in a `syslog.conf`, and all syslog-style entries in `rsyslog.conf`.
Expand Down Expand Up @@ -245,4 +257,3 @@ node.default['fb_syslog']['sysconfig']['vars']['SYSLOGD_OPTIONS'] =

But the `extra_lines` array is also available for forcing arbitrary stuff like
`ulimit` calls.

1 change: 1 addition & 0 deletions cookbooks/fb_syslog/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@
'sysconfig' => sysconfig,
'_enable_syslog_socket_override' => true,
'manage_packages' => true,
'enable_imklog_permitnonkernelfacility' => false,
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $PreserveFQDN on
# Provides support for local system logging (e.g. via logger command)
$ModLoad imuxsock
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
module(load="imklog")

#### GLOBAL DIRECTIVES ####

Expand Down
2 changes: 1 addition & 1 deletion cookbooks/fb_syslog/spec/fixtures/centos6/rsyslog.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $PreserveFQDN on
# Provides support for local system logging (e.g. via logger command)
$ModLoad imuxsock
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
module(load="imklog")

#### GLOBAL DIRECTIVES ####

Expand Down
4 changes: 1 addition & 3 deletions cookbooks/fb_syslog/spec/fixtures/centos6/rsyslog.conf_empty
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $PreserveFQDN on
# Provides support for local system logging (e.g. via logger command)
$ModLoad imuxsock
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
module(load="imklog")

#### GLOBAL DIRECTIVES ####

Expand All @@ -29,5 +29,3 @@ $FileGroup root
$FileCreateMode 0644
$DirCreateMode 0755
$Umask 0002


Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $PreserveFQDN on
$ModLoad imuxsock
$OmitLocalLogging off
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
module(load="imklog")

#### GLOBAL DIRECTIVES ####

Expand Down
2 changes: 1 addition & 1 deletion cookbooks/fb_syslog/spec/fixtures/centos7/rsyslog.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $PreserveFQDN on
$ModLoad imuxsock
$OmitLocalLogging off
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
module(load="imklog")

#### GLOBAL DIRECTIVES ####

Expand Down
4 changes: 1 addition & 3 deletions cookbooks/fb_syslog/spec/fixtures/centos7/rsyslog.conf_empty
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $PreserveFQDN on
$ModLoad imuxsock
$OmitLocalLogging off
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
module(load="imklog")

#### GLOBAL DIRECTIVES ####

Expand All @@ -30,5 +30,3 @@ $FileGroup root
$FileCreateMode 0644
$DirCreateMode 0755
$Umask 0002


Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $PreserveFQDN on
$ModLoad imuxsock
$OmitLocalLogging off
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
module(load="imklog")

#### GLOBAL DIRECTIVES ####

Expand Down
2 changes: 1 addition & 1 deletion cookbooks/fb_syslog/spec/fixtures/centos8/rsyslog.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $PreserveFQDN on
$ModLoad imuxsock
$OmitLocalLogging off
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
module(load="imklog")

#### GLOBAL DIRECTIVES ####

Expand Down
4 changes: 1 addition & 3 deletions cookbooks/fb_syslog/spec/fixtures/centos8/rsyslog.conf_empty
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $PreserveFQDN on
$ModLoad imuxsock
$OmitLocalLogging off
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
module(load="imklog")

#### GLOBAL DIRECTIVES ####

Expand All @@ -30,5 +30,3 @@ $FileGroup root
$FileCreateMode 0644
$DirCreateMode 0755
$Umask 0002


6 changes: 5 additions & 1 deletion cookbooks/fb_syslog/templates/default/rsyslog.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ $ModLoad imuxsock
$OmitLocalLogging off
<% end -%>
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
<% if node['fb_syslog']['enable_imklog_permitnonkernelfacility'] -%>
module(load="imklog" permitnonkernelfacility="on")
<% else %>
module(load="imklog")
<% end -%>
<% if node['fb_syslog']['rsyslog_use_omprog'] -%>
# Provides logging to external programs.
module(load="omprog")
Expand Down

0 comments on commit a622294

Please sign in to comment.