1.\" This file contains changes from the Open Software Foundation. 2.\" 3.\" from: @(#)newsyslog.8 4.\" $FreeBSD$ 5.\" 6.\" Copyright 1988, 1989 by the Massachusetts Institute of Technology 7.\" 8.\" Permission to use, copy, modify, and distribute this software 9.\" and its documentation for any purpose and without fee is 10.\" hereby granted, provided that the above copyright notice 11.\" appear in all copies and that both that copyright notice and 12.\" this permission notice appear in supporting documentation, 13.\" and that the names of M.I.T. and the M.I.T. S.I.P.B. not be 14.\" used in advertising or publicity pertaining to distribution 15.\" of the software without specific, written prior permission. 16.\" M.I.T. and the M.I.T. S.I.P.B. make no representations about 17.\" the suitability of this software for any purpose. It is 18.\" provided "as is" without express or implied warranty. 19.\" 20.Dd February 24, 2005 21.Dt NEWSYSLOG 8 22.Os 23.Sh NAME 24.Nm newsyslog 25.Nd maintain system log files to manageable sizes 26.Sh SYNOPSIS 27.Nm 28.Op Fl CFNnrsv 29.Op Fl R Ar tagname 30.Op Fl a Ar directory 31.Op Fl d Ar directory 32.Op Fl f Ar config_file 33.Op Ar 34.Sh DESCRIPTION 35The 36.Nm 37utility should be scheduled to run periodically by 38.Xr cron 8 . 39When it is executed it archives log files if necessary. 40If a log file 41is determined to require archiving, 42.Nm 43rearranges the files so that 44.Dq Va logfile 45is empty, 46.Dq Va logfile Ns Li \&.0 47has 48the last period's logs in it, 49.Dq Va logfile Ns Li \&.1 50has the next to last 51period's logs in it, and so on, up to a user-specified number of 52archived logs. 53Optionally the archived logs can be compressed to save 54space. 55.Pp 56A log can be archived for three reasons: 57.Bl -enum -offset indent 58.It 59It is larger than the configured size (in kilobytes). 60.It 61A configured number of hours have elapsed since the log was last 62archived. 63.It 64This is the specific configured hour for rotation of the log. 65.El 66.Pp 67The granularity of 68.Nm 69is dependent on how often it is scheduled to run by 70.Xr cron 8 . 71Since the program is quite fast, it may be scheduled to run every hour 72without any ill effects, 73and mode three (above) assumes that this is so. 74.Sh OPTIONS 75The following options can be used with 76.Nm : 77.Bl -tag -width indent 78.It Fl f Ar config_file 79Instruct 80.Nm 81to use 82.Ar config_file 83instead of 84.Pa /etc/newsyslog.conf 85for its configuration file. 86.It Fl a Ar directory 87Specify a 88.Ar directory 89into which archived log files will be written. 90If a relative path is given, 91it is appended to the path of each log file 92and the resulting path is used as the directory 93into which the archived log for that log file will be written. 94If an absolute path is given, 95all archived logs are written into the given 96.Ar directory . 97If any component of the path 98.Ar directory 99does not exist, 100it will be created when 101.Nm 102is run. 103.It Fl d Ar directory 104Specify a 105.Ar directory 106which all log files will be relative to. 107To allow archiving of logs outside the root, the 108.Ar directory 109passed to the 110.Fl a 111option is unaffected. 112.It Fl v 113Place 114.Nm 115in verbose mode. 116In this mode it will print out each log and its 117reasons for either trimming that log or skipping it. 118.It Fl n 119Cause 120.Nm 121not to trim the logs, but to print out what it would do if this option 122were not specified. 123.It Fl r 124Remove the restriction that 125.Nm 126must be running as root. 127Of course, 128.Nm 129will not be able to send a HUP signal to 130.Xr syslogd 8 131so this option should only be used in debugging. 132.It Fl s 133Specify that 134.Nm 135should not send any signals to any daemon processes that it would 136normally signal when rotating a log file. 137For any log file which is rotated, this option will usually also 138mean the rotated log file will not be compressed if there is a 139daemon which would have been signalled without this option. 140However, this option is most likely to be useful when specified 141with the 142.Fl R 143option, and in that case the compression will be done. 144.It Fl C 145If specified once, then 146.Nm 147will create any log files which do not exist, and which have the 148.Sy C 149flag specified in their config file entry. 150If specified multiple times, then 151.Nm 152will create all log files which do not already exist. 153If log files are given on the command-line, then the 154.Fl C 155or 156.Fl CC 157will only apply to those specific log files. 158.It Fl F 159Force 160.Nm 161to trim the logs, even if the trim conditions have not been met. 162This 163option is useful for diagnosing system problems by providing you with 164fresh logs that contain only the problems. 165.It Fl N 166Do not perform any rotations. 167This option is intended to be used with the 168.Fl C 169or 170.Fl CC 171options when creating log files is the only objective. 172.It Fl R Ar tagname 173Specify that 174.Nm 175should rotate a given list of files, even if trim conditions are not 176met for those files. 177The 178.Ar tagname 179is only used in the messages written to the log files which are 180rotated. 181This differs from the 182.Fl F 183option in that one or more log files must also be specified, so that 184.Nm 185will only operate on those specific files. 186This option is mainly intended for the daemons or programs which write 187some log files, and want to trigger a rotate based on their own criteria. 188With this option they can execute 189.Nm 190to trigger the rotate when they want it to happen, and still give the 191system administrator a way to specify the rules of rotation (such as how 192many backup copies are kept, and what kind of compression is done). 193When a daemon does execute 194.Nm 195with the 196.Fl R 197option, it should make sure all of the log files are closed before 198calling 199.Nm , 200and then it should re-open the files after 201.Nm 202returns. 203Usually the calling process will also want to specify the 204.Fl s 205option, so 206.Nm 207will not send a signal to the very process which called it to force 208the rotate. 209Skipping the signal step will also mean that 210.Nm 211will return faster, since 212.Nm 213normally waits a few seconds after any signal that is sent. 214.El 215.Pp 216If additional command line arguments are given, 217.Nm 218will only examine log files that match those arguments; otherwise, it 219will examine all files listed in the configuration file. 220.Sh FILES 221.Bl -tag -width /etc/newsyslog.confxxxx -compact 222.It Pa /etc/newsyslog.conf 223.Nm 224configuration file 225.El 226.Sh COMPATIBILITY 227Previous versions of the 228.Nm 229utility used the dot (``.'') character to 230distinguish the group name. 231Beginning with 232.Fx 3.3 , 233this has been changed to a colon (``:'') character so that user and group 234names may contain the dot character. 235The dot (``.'') character is still 236accepted for backwards compatibility. 237.Sh HISTORY 238The 239.Nm 240utility originated from 241.Nx 242and first appeared in 243.Fx 2.2 . 244.Sh AUTHORS 245.An Theodore Ts'o , 246MIT Project Athena 247.Pp 248Copyright 1987, Massachusetts Institute of Technology 249.Sh "SEE ALSO" 250.Xr bzip2 1 , 251.Xr gzip 1 , 252.Xr syslog 3 , 253.Xr newsyslog.conf 5 , 254.Xr chown 8 , 255.Xr syslogd 8 256.Sh BUGS 257Does not yet automatically read the logs to find security breaches. 258