parent
cb4069d95e
commit
b2392ff31c
|
@ -357,6 +357,14 @@
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>ReadKMsg=</varname></term>
|
||||||
|
|
||||||
|
<listitem><para>Takes a boolean value. If enabled (the
|
||||||
|
default), journal reads <filename>/dev/kmsg</filename>
|
||||||
|
messages generated by the kernel.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>TTYPath=</varname></term>
|
<term><varname>TTYPath=</varname></term>
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ struct ConfigPerfItem;
|
||||||
Journal.Storage, config_parse_storage, 0, offsetof(Server, storage)
|
Journal.Storage, config_parse_storage, 0, offsetof(Server, storage)
|
||||||
Journal.Compress, config_parse_bool, 0, offsetof(Server, compress)
|
Journal.Compress, config_parse_bool, 0, offsetof(Server, compress)
|
||||||
Journal.Seal, config_parse_bool, 0, offsetof(Server, seal)
|
Journal.Seal, config_parse_bool, 0, offsetof(Server, seal)
|
||||||
|
Journal.ReadKMsg, config_parse_bool, 0, offsetof(Server, read_kmsg)
|
||||||
Journal.SyncIntervalSec, config_parse_sec, 0, offsetof(Server, sync_interval_usec)
|
Journal.SyncIntervalSec, config_parse_sec, 0, offsetof(Server, sync_interval_usec)
|
||||||
# The following is a legacy name for compatibility
|
# The following is a legacy name for compatibility
|
||||||
Journal.RateLimitInterval, config_parse_sec, 0, offsetof(Server, rate_limit_interval)
|
Journal.RateLimitInterval, config_parse_sec, 0, offsetof(Server, rate_limit_interval)
|
||||||
|
|
|
@ -397,17 +397,26 @@ static int dispatch_dev_kmsg(sd_event_source *es, int fd, uint32_t revents, void
|
||||||
}
|
}
|
||||||
|
|
||||||
int server_open_dev_kmsg(Server *s) {
|
int server_open_dev_kmsg(Server *s) {
|
||||||
|
mode_t mode;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|
||||||
s->dev_kmsg_fd = open("/dev/kmsg", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
|
if (s->read_kmsg)
|
||||||
|
mode = O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY;
|
||||||
|
else
|
||||||
|
mode = O_WRONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY;
|
||||||
|
|
||||||
|
s->dev_kmsg_fd = open("/dev/kmsg", mode);
|
||||||
if (s->dev_kmsg_fd < 0) {
|
if (s->dev_kmsg_fd < 0) {
|
||||||
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
|
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
|
||||||
"Failed to open /dev/kmsg, ignoring: %m");
|
"Failed to open /dev/kmsg, ignoring: %m");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!s->read_kmsg)
|
||||||
|
return 0;
|
||||||
|
|
||||||
r = sd_event_add_io(s->event, &s->dev_kmsg_event_source, s->dev_kmsg_fd, EPOLLIN, dispatch_dev_kmsg, s);
|
r = sd_event_add_io(s->event, &s->dev_kmsg_event_source, s->dev_kmsg_fd, EPOLLIN, dispatch_dev_kmsg, s);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
|
||||||
|
|
|
@ -1915,6 +1915,7 @@ int server_init(Server *s) {
|
||||||
s->syslog_fd = s->native_fd = s->stdout_fd = s->dev_kmsg_fd = s->audit_fd = s->hostname_fd = s->notify_fd = -1;
|
s->syslog_fd = s->native_fd = s->stdout_fd = s->dev_kmsg_fd = s->audit_fd = s->hostname_fd = s->notify_fd = -1;
|
||||||
s->compress = true;
|
s->compress = true;
|
||||||
s->seal = true;
|
s->seal = true;
|
||||||
|
s->read_kmsg = true;
|
||||||
|
|
||||||
s->watchdog_usec = USEC_INFINITY;
|
s->watchdog_usec = USEC_INFINITY;
|
||||||
|
|
||||||
|
@ -2051,7 +2052,7 @@ int server_init(Server *s) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* /dev/ksmg */
|
/* /dev/kmsg */
|
||||||
r = server_open_dev_kmsg(s);
|
r = server_open_dev_kmsg(s);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -112,6 +112,7 @@ struct Server {
|
||||||
|
|
||||||
bool compress;
|
bool compress;
|
||||||
bool seal;
|
bool seal;
|
||||||
|
bool read_kmsg;
|
||||||
|
|
||||||
bool forward_to_kmsg;
|
bool forward_to_kmsg;
|
||||||
bool forward_to_syslog;
|
bool forward_to_syslog;
|
||||||
|
|
Loading…
Reference in a new issue