log_ratelimit_full_errno(level, 0, _ratelimit, format, ##__VA_ARGS__)
/* Normal logging */
-#define log_ratelimit_debug(...) log_ratelimit_full(LOG_DEBUG, __VA_ARGS__)
#define log_ratelimit_info(...) log_ratelimit_full(LOG_INFO, __VA_ARGS__)
#define log_ratelimit_notice(...) log_ratelimit_full(LOG_NOTICE, __VA_ARGS__)
#define log_ratelimit_warning(...) log_ratelimit_full(LOG_WARNING, __VA_ARGS__)
#define log_ratelimit_emergency(...) log_ratelimit_full(log_emergency_level(), __VA_ARGS__)
/* Logging triggered by an errno-like error */
-#define log_ratelimit_debug_errno(error, ...) log_ratelimit_full_errno(LOG_DEBUG, error, __VA_ARGS__)
#define log_ratelimit_info_errno(error, ...) log_ratelimit_full_errno(LOG_INFO, error, __VA_ARGS__)
#define log_ratelimit_notice_errno(error, ...) log_ratelimit_full_errno(LOG_NOTICE, error, __VA_ARGS__)
#define log_ratelimit_warning_errno(error, ...) log_ratelimit_full_errno(LOG_WARNING, error, __VA_ARGS__)
const char *v;
if (*n >= m) {
- log_ratelimit_debug(
- JOURNALD_LOG_RATELIMIT,
+ log_debug(
"More fields in audit message than audit field limit (%i), skipping remaining fields",
N_IOVEC_AUDIT_FIELDS);
return 0;
r = mf->map(mf->journal_field, &v, iovec, n);
if (r < 0)
- return log_ratelimit_debug_errno(r, JOURNALD_LOG_RATELIMIT,
- "Failed to parse audit array: %m");
+ return log_debug_errno(r, "Failed to parse audit array: %m");
if (r > 0) {
mapped = true;
if (!mapped) {
r = map_generic_field(prefix, &p, iovec, n);
if (r < 0)
- return log_ratelimit_debug_errno(r, JOURNALD_LOG_RATELIMIT,
- "Failed to parse audit array: %m");
+ return log_debug_errno(r, "Failed to parse audit array: %m");
if (r == 0)
/* Couldn't process as generic field, let's just skip over it */
salen != sizeof(struct sockaddr_nl) ||
sa->nl.nl_family != AF_NETLINK ||
sa->nl.nl_pid != 0) {
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT, "Audit netlink message from invalid sender.");
+ log_debug("Audit netlink message from invalid sender.");
return;
}
if (!ucred || ucred->pid != 0) {
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT, "Audit netlink message with invalid credentials.");
+ log_debug("Audit netlink message with invalid credentials.");
return;
}
fd = open_terminal(tty, O_WRONLY|O_NOCTTY|O_CLOEXEC);
if (fd < 0) {
- log_ratelimit_debug_errno(fd, JOURNALD_LOG_RATELIMIT, "Failed to open %s for logging: %m", tty);
+ log_debug_errno(fd, "Failed to open %s for logging: %m", tty);
return;
}
if (writev(fd, iovec, n) < 0)
- log_ratelimit_debug_errno(errno, JOURNALD_LOG_RATELIMIT, "Failed to write to %s for logging: %m", tty);
+ log_debug_errno(errno, "Failed to write to %s for logging: %m", tty);
}
iovec[n++] = IOVEC_MAKE_STRING("\n");
if (writev(s->dev_kmsg_fd, iovec, n) < 0)
- log_ratelimit_debug_errno(errno, JOURNALD_LOG_RATELIMIT,
- "Failed to write to /dev/kmsg for logging: %m");
+ log_debug_errno(errno, "Failed to write to /dev/kmsg for logging: %m");
}
static bool is_us(const char *identifier, const char *pid) {
if (!s->dev_kmsg_readable)
return 0;
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT, "Flushing /dev/kmsg...");
+ log_debug("Flushing /dev/kmsg...");
for (;;) {
r = server_read_dev_kmsg(s);
if (!e) {
/* Trailing noise, let's ignore it, and flush what we collected */
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Received message with trailing noise, ignoring.");
+ log_debug("Received message with trailing noise, ignoring.");
break; /* finish processing of the message */
}
/* A property follows */
if (n > ENTRY_FIELD_COUNT_MAX) {
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Received an entry that has more than " STRINGIFY(ENTRY_FIELD_COUNT_MAX) " fields, ignoring entry.");
+ log_debug("Received an entry that has more than " STRINGIFY(ENTRY_FIELD_COUNT_MAX) " fields, ignoring entry.");
goto finish;
}
l = e - p;
if (l > DATA_SIZE_MAX) {
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Received text block of %zu bytes is too large, ignoring entry.", l);
+ log_debug("Received text block of %zu bytes is too large, ignoring entry.", l);
goto finish;
}
if (entry_size + l + n + 1 > ENTRY_SIZE_MAX) { /* data + separators + trailer */
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Entry is too big (%zu bytes after processing %zu entries), ignoring entry.",
- entry_size + l, n + 1);
+ log_debug("Entry is too big (%zu bytes after processing %zu entries), ignoring entry.",
+ entry_size + l, n + 1);
goto finish;
}
char *k;
if (*remaining < e - p + 1 + sizeof(uint64_t) + 1) {
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Failed to parse message, ignoring.");
+ log_debug("Failed to parse message, ignoring.");
break;
}
l = unaligned_read_le64(e + 1);
if (l > DATA_SIZE_MAX) {
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Received binary data block of %"PRIu64" bytes is too large, ignoring entry.",
- l);
+ log_debug("Received binary data block of %"PRIu64" bytes is too large, ignoring entry.", l);
goto finish;
}
total = (e - p) + 1 + l;
if (entry_size + total + n + 1 > ENTRY_SIZE_MAX) { /* data + separators + trailer */
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Entry is too big (%"PRIu64"bytes after processing %zu fields), ignoring.",
- entry_size + total, n + 1);
+ log_debug("Entry is too big (%"PRIu64"bytes after processing %zu fields), ignoring.",
+ entry_size + total, n + 1);
goto finish;
}
if ((uint64_t) *remaining < e - p + 1 + sizeof(uint64_t) + l + 1 ||
e[1+sizeof(uint64_t)+l] != '\n') {
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Failed to parse message, ignoring.");
+ log_debug("Failed to parse message, ignoring.");
break;
}
entry_size += STRLEN("_TRANSPORT=journal");
if (entry_size + n + 1 > ENTRY_SIZE_MAX) { /* data + separators + trailer */
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Entry is too big with %zu properties and %zu bytes, ignoring.",
- n, entry_size);
+ log_debug("Entry is too big with %zu properties and %zu bytes, ignoring.", n, entry_size);
goto finish;
}
continue;
if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0) {
- log_ratelimit_debug_errno(errno, JOURNALD_LOG_RATELIMIT,
- "Failed to stat %s/%s, ignoring: %m", path, de->d_name);
+ log_debug_errno(errno, "Failed to stat %s/%s, ignoring: %m", path, de->d_name);
continue;
}
r = parse_uid(u, &uid);
if (r < 0) {
- log_ratelimit_debug_errno(r, JOURNALD_LOG_RATELIMIT,
- "Failed to parse UID from file name '%s', ignoring: %m",
- de->d_name);
+ log_debug_errno(r, "Failed to parse UID from file name '%s', ignoring: %m", de->d_name);
continue;
}
"Failed to move %s out of the way, ignoring: %m",
full);
else
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT,
- "Successfully moved %s out of the way.", full);
+ log_debug("Successfully moved %s out of the way.", full);
continue;
}
r = journal_file_archive(f->file, NULL);
if (r < 0)
- log_ratelimit_debug_errno(r, JOURNALD_LOG_RATELIMIT,
- "Failed to archive journal file '%s', ignoring: %m", full);
+ log_debug_errno(r, "Failed to archive journal file '%s', ignoring: %m", full);
managed_journal_file_initiate_close(f, s->deferred_closes);
f = NULL;
void *k;
int r;
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT, "Rotating...");
+ log_debug("Rotating...");
/* First, rotate the system journal (either in its runtime flavour or in its runtime flavour) */
(void) do_rotate(s, &s->runtime_journal, "runtime", false, 0);
void server_vacuum(Server *s, bool verbose) {
assert(s);
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT, "Vacuuming...");
+ log_debug("Vacuuming...");
s->oldest_file_usec = 0;
case -EFBIG: /* Hit fs limit */
case -EDQUOT: /* Quota limit hit */
case -ENOSPC: /* Disk full */
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT, "%s: Allocation limit reached, rotating.", f->path);
+ log_debug("%s: Allocation limit reached, rotating.", f->path);
return true;
case -EIO: /* I/O error of some kind (mmap) */
if (!f)
return;
- log_ratelimit_debug_errno(r, JOURNALD_LOG_RATELIMIT, "Retrying write.");
+ log_debug_errno(r, "Retrying write.");
r = journal_file_append_entry(f->file, &ts, NULL, iovec, n, &s->seqnum, NULL, NULL);
if (r < 0)
log_ratelimit_error_errno(r, FAILED_TO_WRITE_ENTRY_RATELIMIT,
if (!s->system_journal)
return 0;
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT, "Flushing to %s...", s->system_storage.path);
+ log_debug("Flushing to %s...", s->system_storage.path);
start = now(CLOCK_MONOTONIC);
goto finish;
}
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT, "Retrying write.");
+ log_debug("Retrying write.");
r = journal_file_copy_entry(f, s->system_journal->file, o, f->current_offset);
if (r < 0) {
log_ratelimit_error_errno(r, JOURNALD_LOG_RATELIMIT, "Can't write entry: %m");
if (s->runtime_journal && !s->system_journal)
return 0;
- log_ratelimit_debug(JOURNALD_LOG_RATELIMIT, "Relinquishing %s...", s->system_storage.path);
+ log_debug("Relinquishing %s...", s->system_storage.path);
(void) system_journal_open(s, false, true);
j = strjoina(s->runtime_directory, "/syslog");
r = sockaddr_un_set_path(&sa.un, j);
if (r < 0) {
- log_ratelimit_debug_errno(r, JOURNALD_LOG_RATELIMIT,
- "Forwarding socket path %s too long for AF_UNIX, not forwarding: %m", j);
+ log_debug_errno(r, "Forwarding socket path %s too long for AF_UNIX, not forwarding: %m", j);
return;
}
}
if (errno != ENOENT)
- log_ratelimit_debug_errno(errno, JOURNALD_LOG_RATELIMIT, "Failed to forward syslog message: %m");
+ log_debug_errno(errno, "Failed to forward syslog message: %m");
}
static void forward_syslog_raw(Server *s, int priority, const char *buffer, size_t buffer_len, const struct ucred *ucred, const struct timeval *tv) {
r = utmp_wall(l, "systemd-journald", NULL, NULL, NULL);
if (r < 0)
- log_ratelimit_debug_errno(r, JOURNALD_LOG_RATELIMIT, "Failed to send wall message: %m");
+ log_debug_errno(r, "Failed to send wall message: %m");
}