Vacuuming behaviour is a bit confusing, and/or we have some bugs,
so those additional messages should help to find out what's going
on. Also, rotation of journal files shouldn't be happening too
often, so the level of the messages is bumped to info, so that
they'll be logged under normal operation.
- if ((l = read(f->fd, ((uint8_t*) &f->buffer) + f->bytes_read, sizeof(f->buffer) - f->bytes_read)) <= 0) {
-
+ l = read(f->fd,
+ ((uint8_t*) &f->buffer) + f->bytes_read,
+ sizeof(f->buffer) - f->bytes_read);
+ if (l <= 0) {
if (errno == EAGAIN)
return 0;
if (errno == EAGAIN)
return 0;
}
f = (Fifo*) ev->data.ptr;
}
f = (Fifo*) ev->data.ptr;
-
- if ((r = fifo_process(f)) < 0) {
+ r = fifo_process(f);
+ if (r < 0) {
log_info("Got error on fifo: %s", strerror(-r));
fifo_free(f);
return r;
log_info("Got error on fifo: %s", strerror(-r));
fifo_free(f);
return r;
struct vacuum_info *list = NULL;
unsigned n_list = 0, i;
size_t n_allocated = 0;
struct vacuum_info *list = NULL;
unsigned n_list = 0, i;
size_t n_allocated = 0;
+ uint64_t sum = 0, freed = 0;
usec_t retention_limit = 0;
assert(directory);
usec_t retention_limit = 0;
assert(directory);
continue;
if (journal_file_empty(dirfd(d), p)) {
continue;
if (journal_file_empty(dirfd(d), p)) {
/* Always vacuum empty non-online files. */
/* Always vacuum empty non-online files. */
- if (unlinkat(dirfd(d), p, 0) >= 0)
- log_debug("Deleted empty journal %s/%s.", directory, p);
- else if (errno != ENOENT)
+ uint64_t size = 512UL * (uint64_t) st.st_blocks;
+
+ if (unlinkat(dirfd(d), p, 0) >= 0) {
+ log_info("Deleted empty journal %s/%s (%"PRIu64" bytes).",
+ directory, p, size);
+ freed += size;
+ } else if (errno != ENOENT)
log_warning("Failed to delete %s/%s: %m", directory, p);
log_warning("Failed to delete %s/%s: %m", directory, p);
break;
if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) {
break;
if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) {
- log_debug("Deleted archived journal %s/%s.", directory, list[i].filename);
+ log_debug("Deleted archived journal %s/%s (%"PRIu64" bytes).",
+ directory, list[i].filename, list[i].usage);
+ freed += list[i].usage;
if (list[i].usage < sum)
sum -= list[i].usage;
if (list[i].usage < sum)
sum -= list[i].usage;
free(list[i].filename);
free(list);
free(list[i].filename);
free(list);
+ log_info("Vacuuming done, freed %"PRIu64" bytes", freed);
+
int main(int argc, char *argv[]) {
int r;
int main(int argc, char *argv[]) {
int r;
- _cleanup_journal_close_ sd_journal*j = NULL;
+ _cleanup_journal_close_ sd_journal *j = NULL;
bool need_seek = false;
sd_id128_t previous_boot_id;
bool previous_boot_id_valid = false, first_line = true;
bool need_seek = false;
sd_id128_t previous_boot_id;
bool previous_boot_id_valid = false, first_line = true;
}
if (sfsi.ssi_signo == SIGUSR1) {
}
if (sfsi.ssi_signo == SIGUSR1) {
+ log_info("Received request to flush runtime journal from PID %"PRIu32,
+ sfsi.ssi_pid);
touch("/run/systemd/journal/flushed");
server_flush_to_var(s);
server_sync(s);
touch("/run/systemd/journal/flushed");
server_flush_to_var(s);
server_sync(s);
}
if (sfsi.ssi_signo == SIGUSR2) {
}
if (sfsi.ssi_signo == SIGUSR2) {
+ log_info("Received request to rotate journal from PID %"PRIu32,
+ sfsi.ssi_pid);
server_rotate(s);
server_vacuum(s);
return 1;
server_rotate(s);
server_vacuum(s);
return 1;