NEWSYSLOG(8)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ‘‘ NEWSYSLOG(8) β€” the system manager's manual, but make it make sense

okay so bestie, welcome to newsyslog, from the System Manager's Manual section 8 (system admin commands, iykyk). this is the girl who keeps your log files from becoming absolute unit-sized monsters πŸ‰


✨ NAME ✨

newsyslog β€” rotate system message log files to maintain manageable sizes

like, she tidies up your logs so they stay cute and small instead of eating your whole disk πŸ’…


🫢 SYNOPSIS 🫢

newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f config_file]
          [-S pidfile] [-t timefmt] [[-R tagname] file ...]

that's the whole vibe right there, don't worry we're gonna go through every single piece πŸŽ€


🌸 DESCRIPTION 🌸

so the way this works: newsyslog is supposed to be scheduled by cron(8) to run periodically. she's on a schedule, she's booked and busy. and when she runs, she archives log files if necessary β€” key phrase if necessary, she's not out here doing the most for no reason.

when a log file is determined to require archiving, newsyslog rearranges the files so that <italic>logfile</italic> is empty, <italic>logfile</italic>.0 has the last period's logs in it, <italic>logfile</italic>.1 has the next to last period's logs in it, and so on, up to a user-specified number of archived logs πŸ”„ it's giving shift rotation, it's giving hand-me-downs, it's giving the archives are numbered and everyone knows their place.

it's also possible to let archived log filenames be created using the time the log file was archived instead of the sequential number, using the -t option ⏰ main character behavior honestly.

optionally the archived logs can be compressed to save space β€” because, again, we respect the disk πŸ—œοΈ


🎯 a log can be archived for three reasons

  1. It is larger than the configured size (in kilobytes). chonky = archived πŸ’€
  2. A configured number of hours have elapsed since the log was last archived. it's been a minute, girl ⏳
  3. This is the specific configured hour for rotation of the log. scheduled slay πŸ‘‘

the granularity of newsyslog is dependent on how often it is scheduled to run by cron(8) β€” so like, how often she gets pinged matters. since the program is quite fast, it may be scheduled to run every hour without any ill effects, and mode three (above) assumes that this is so πŸ™ˆ like, hour three literally assumes she's running hourly, that's the contract, that's the arrangement.


πŸ’– OPTIONS πŸ’–

the following options can be used with newsyslog β€” buckle up bestie, there's a lot but they're all genuinely useful:

  • -f config_file β€” instruct newsyslog to use config_file instead of /etc/newsyslog.conf for its configuration file. custom config, custom rules, custom everything πŸŽ€
  • -a directory β€” specify a directory into which archived log files will be written. if a relative path is given, it is appended to the path of each log file and the resulting path is used as the directory into which the archived log for that log file will be written. if an absolute path is given, all archived logs are written into the given directory. if any component of the path directory does not exist, it will be created when newsyslog is run πŸ“ she'll build it herself, no cap
  • -d directory β€” specify a directory which all log files will be relative to. to allow archiving of logs outside the root, the directory passed to the -a option is unaffected πŸ‘€ yes, -a stays its own independent girl
  • -v β€” place newsyslog in verbose mode. in this mode it will print out each log and its reasons for either trimming that log or skipping it πŸ—£οΈ she's explaining herself, we love a communicative queen
  • -n β€” cause newsyslog not to trim the logs, but to print out what it would do if this option were not specified. this option implies the -r option πŸͺž dry run, delulu edition β€” all hypotheticals, zero consequences
  • -r β€” remove the restriction that newsyslog must be running as root. of course, newsyslog will not be able to send a HUP signal to syslogd(8) so this option should only be used in debugging ⚠️ like, fr fr, debugging only
  • -s β€” specify that newsyslog should not send any signals to any daemon processes that it would normally signal when rotating a log file. for any log file which is rotated, this option will usually also mean the rotated log file will not be compressed if there is a daemon which would have been signalled without this option. however, this option is most likely to be useful when specified with the -R option, and in that case the compression will be done 🀫 quiet mode, no signals, sometimes no compression β€” but with -R she still compresses, periodt
  • -t timefmt β€” if specified, newsyslog will create the "rotated" logfiles using the specified time format instead of the default sequential filenames. the filename used will be kept until it is deleted. the time format is described in the strftime(3) manual page. if the timefmt argument is set to an empty string or the string DEFAULT, the default built in time format is used. if the timefmt string is changed the old files created using the previous time format will not be automatically removed (unless the new format is very similar to the old format). this is also the case when changing from sequential filenames to time based file names, and the other way around. the time format should contain at least year, month, day, and hour to make sure rotating of old logfiles can select the correct logfiles πŸ“…βš οΈ okay so this is the big one β€” timestamp names are sticky, and switching formats leaves stragglers behind. and please include year/month/day/hour or the rotation girl cannot find her own files 😭
  • -C β€” if specified once, then newsyslog will create any log files which do not exist, and which have the C flag specified in their config file entry. if specified multiple times, then newsyslog will create all log files which do not already exist. if log files are given on the command-line, then the -C or -CC will only apply to those specific log files 🐣 baby log files get born on demand
  • -F β€” force newsyslog to trim the logs, even if the trim conditions have not been met. this option is useful for diagnosing system problems by providing you with fresh logs that contain only the problems πŸ”₯ no waiting for conditions, we trim NOW, fresh start energy
  • -N β€” do not perform any rotations. this option is intended to be used with the -C or -CC options when creating log files is the only objective πŸš«πŸ”„ look but don't rotate
  • -P β€” prevent further action if we should send signal but the "pidfile" is empty or does not exist πŸ›‘ she checks the pidfile and if it's giving nothing, she stops. no vibes, no signal
  • -R tagname β€” specify that newsyslog should rotate a given list of files, even if trim conditions are not met for those files. the tagname is only used in the messages written to the log files which are rotated. this differs from the -F option in that one or more log files must also be specified, so that newsyslog will only operate on those specific files. this option is mainly intended for the daemons or programs which write some log files, and want to trigger a rotate based on their own criteria. with this option they can execute newsyslog to trigger the rotate when they want it to happen, and still give the system administrator a way to specify the rules of rotation (such as how many backup copies are kept, and what kind of compression is done). when a daemon does execute newsyslog with the -R option, it should make sure all of the log files are closed before calling newsyslog, and then it should re-open the files after newsyslog returns. usually the calling process will also want to specify the -s option, so newsyslog will not send a signal to the very process which called it to force the rotate. skipping the signal step will also mean that newsyslog will return faster, since newsyslog normally waits a few seconds after any signal that is sent πŸ·οΈπŸ“£ daemon-triggered rotation, the ultimate "i'll handle my own scheduling" move
  • -S pidfile β€” use pidfile as syslogd(8)'s pidfile πŸ“Œ tell her where the pidfile lives

if additional command line arguments are given, newsyslog will only examine log files that match those arguments; otherwise, it will examine all files listed in the configuration file. so like, you can be selective, she respects your boundaries πŸ’…


πŸ¦‹ FILES πŸ¦‹

  • /etc/newsyslog.conf β€” newsyslog configuration file, the main character of configs πŸ“„
  • /etc/newsyslog.conf.d β€” by default each file in this directory ending in '.conf' and not beginning with a '.' will be included by the default newsyslog.conf πŸ“‚βœ¨
  • /usr/local/etc/newsyslog.conf.d β€” by default each file in this directory ending in '.conf' and not beginning with a '.' will be included by the default newsyslog.conf πŸ“‚πŸ’œ
both drop-in directories have the same rule bestie: ends in '.conf', does not start with a '.', or it's not getting included. hidden files stay hidden πŸ™ˆ

🌈 COMPATIBILITY 🌈

previous versions of the newsyslog utility used the dot (".") character to distinguish the group name. beginning with FreeBSD 3.3, this has been changed to a colon (":") character so that user and group names may contain the dot character. the dot (".") character is still accepted for backwards compatibility πŸ•°οΈ so like, glow-up happened in FreeBSD 3.3, but the old dot still works, she's not gonna break your legacy setups, she's not that kind of girl 🫢


πŸ‘€ SEE ALSO πŸ‘€

bzip2(1), gzip(1), xz(1), zstd(1), syslog(3), newsyslog.conf(5), chown(8), syslogd(8)

the whole friend group πŸ’– go read newsyslog.conf(5) if you wanna actually configure this thing, and syslogd(8) because they're literally linked like that


πŸ“œ HISTORY πŸ“œ

the newsyslog utility originated from NetBSD and first appeared in FreeBSD 2.2 β€” an icon with lore, we stan a well-documented origin story 🌟


🫑 AUTHORS 🫑

Theodore Ts'o, MIT Project Athena

Copyright 1987, Massachusetts Institute of Technology


and that's the whole page bestie!! every flag, every path, every caveat, all of it πŸ’œ

this beauty ships with Debian, dated March 8, 2026 β€” that's the source and the date, and honestly? iconic. go rotate some logs. slay. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms