Thank you for this very useful tool! Unfortunately, rotate_logs() will cause an error ("Error in xj[i] : only 0's may be mixed with negative subscripts") if there are less than rotate_lines lines in the logfile.
I suggest the following fix: Replace lines 85-86 of loggit/R/utils.R with
if (nrow(log_df) > rotate_lines) {
log_df <- log_df[(nrow(log_df) - rotate_lines + 1):nrow(log_df), ]
write_ndjson(log_df, logfile, echo = FALSE, overwrite = TRUE)
}