NEWSYSLOG(8)
π 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
- It is larger than the configured size (in kilobytes). chonky = archived π
- A configured number of hours have elapsed since the log was last archived. it's been a minute, girl β³
- 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:
-fconfig_file β instructnewsyslogto use config_file instead of/etc/newsyslog.conffor its configuration file. custom config, custom rules, custom everything π-adirectory β 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 whennewsyslogis run π she'll build it herself, no cap-ddirectory β specify a directory which all log files will be relative to. to allow archiving of logs outside the root, the directory passed to the-aoption is unaffected π yes,-astays its own independent girl-vβ placenewsyslogin 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β causenewsyslognot to trim the logs, but to print out what it would do if this option were not specified. this option implies the-roption πͺ dry run, delulu edition β all hypotheticals, zero consequences-rβ remove the restriction thatnewsyslogmust be running as root. of course,newsyslogwill not be able to send aHUPsignal tosyslogd(8)so this option should only be used in debugging β οΈ like, fr fr, debugging only-sβ specify thatnewsyslogshould 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-Roption, and in that case the compression will be done π€« quiet mode, no signals, sometimes no compression β but with-Rshe still compresses, periodt-ttimefmt β if specified,newsyslogwill 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 thestrftime(3)manual page. if the timefmt argument is set to an empty string or the stringDEFAULT, 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, thennewsyslogwill create any log files which do not exist, and which have theCflag specified in their config file entry. if specified multiple times, thennewsyslogwill create all log files which do not already exist. if log files are given on the command-line, then the-Cor-CCwill only apply to those specific log files π£ baby log files get born on demand-Fβ forcenewsyslogto 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-Cor-CCoptions 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-Rtagname β specify thatnewsyslogshould 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-Foption in that one or more log files must also be specified, so thatnewsyslogwill 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 executenewsyslogto 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 executenewsyslogwith the-Roption, it should make sure all of the log files are closed before callingnewsyslog, and then it should re-open the files afternewsyslogreturns. usually the calling process will also want to specify the-soption, sonewsyslogwill not send a signal to the very process which called it to force the rotate. skipping the signal step will also mean thatnewsyslogwill return faster, sincenewsyslognormally waits a few seconds after any signal that is sent π·οΈπ£ daemon-triggered rotation, the ultimate "i'll handle my own scheduling" move-Spidfile β use pidfile assyslogd(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βnewsyslogconfiguration 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 defaultnewsyslog.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 defaultnewsyslog.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
- Copyright 1988, 1989 by the Massachusetts Institute of Technology
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms