1.\" This file contains changes from the Open Software Foundation. 2.\" 3.\" from: @(#)newsyslog.8 4.\" $Id: newsyslog.8,v 1.17 1999/01/28 19:56:05 wollman Exp $ 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 January 27, 1999 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 newsyslog 28.Op Fl Fnrv 29.Op Fl f Ar config_file 30.Sh DESCRIPTION 31.Nm Newsyslog 32is a program that should be scheduled to run periodically by 33.Xr cron 8 . 34When it is executed it archives log files if necessary. If a log file 35is determined to require archiving, 36.Nm 37rearranges the files so that 38.Dq Va logfile 39is empty, 40.Dq Va logfile Ns Li \&.0 41has 42the last period's logs in it, 43.Dq Va logfile Ns Li \&.1 44has the next to last 45period's logs in it, and so on, up to a user-specified number of 46archived logs. Optionally the archived logs can be compressed to save 47space. 48.Pp 49A log can be archived for three reasons: 50.Bl -enum -offset indent 51.It 52It is larger than the configured size (in kilobytes). 53.It 54A configured number of hours have elapsed since the log was last 55archived. 56.It 57This is the specific configured hour for rotation of the log. 58.El 59The granularity of 60.Nm 61is dependent on how often it is scheduled to run by 62.Xr cron 8 . 63Since the program is quite fast, it may be scheduled to run every hour 64without any ill effects, 65and mode three (above) assumes that this is so. 66.Pp 67When starting up, 68.Nm 69reads in a configuration file to determine which logs may potentially 70be archived. 71By default, this configuration file is 72.Pa /etc/newsyslog.conf . 73Each line of the file contains information about a particular log file 74that should be handled by 75.Nm newsyslog . 76Each line has five mandatory fields and four optional fields, with a 77whitespace separating each field. Blank lines or lines beginning with 78``#'' are ignored. The fields of the configuration file are as 79follows: 80.Pp 81.Bl -tag -width indent 82.It Ar logfile_name 83Name of the system log file to be archived. 84.It Ar owner.group 85This optional field specifies the owner and group for the archive file. 86The "." is essential, even if the 87.Ar owner 88or 89.Ar group 90field is left blank. The field may be numeric, or a name which is 91present in 92.Pa /etc/passwd 93or 94.Pa /etc/group . 95.It Ar mode 96Specify the mode of the log file and archives. 97.It Ar count 98Specify the number of archive files to be kept 99besides the log file itself. 100.It Ar size 101When the size of the log file reaches 102.Ar size 103in kilobytes, 104the log file will be trimmed as described above. If this field 105is replaced by an asterisk 106.Pq Ql \&* , 107then the size of the log file is not taken into account 108when determining when to trim the log file. 109.It Ar when 110The 111.Ar when 112field can consist of an interval, a specific time, or both. If 113the 114.Ar when 115field is an asterisk 116.Pq Ql \&* 117log rotation will depend only on the contents of the 118.Ar size 119field. 120Otherwise, the 121.Ar when 122field consists of an optional interval in hours, optionally followed 123by an 124.So Li \&@ Sc Ns No -sign 125and a time in a restricted 126.Tn ISO 8601 127format. If a time is specified, the log file will only be trimmed 128if 129.Nm newsyslog 130is run within one hour of the specified time. If an 131interval is specified, the log file will be trimmed if that many hours have 132passed since the last rotation. When both a time and an interval are 133specified, both conditions must be satisfied for the rotation to take 134place. 135.Pp 136The particular format of the time is 137.Sm off 138.Oo 139.Oo 140.Oo 141.Oo 142.Oo 143.Va \&cc 144.Oc 145.Va \&yy 146.Oc 147.Va \&mm 148.Oc 149.Va \&dd 150.Oc 151.Oo 152.Li \&T 153.Oo 154.Va \&hh 155.Oo 156.Va \&mm 157.Oo 158.Va \&ss 159.Oc 160.Oc 161.Oc 162.Oc 163.Oc . 164.Sm on 165Optional date fields default to the appropriate component of the 166current date; optional time fields default to midnight; hence if today 167is January 22, 1999, the following date specifications are all 168equivalent: 169.Pp 170.Bl -item -compact -offset indent 171.It 172.Sq Li 19990122T000000 173.It 174.Sq Li 990122T000000 175.It 176.Sq Li 0122T000000 177.It 178.Sq Li 22T000000 179.It 180.Sq Li T000000 181.It 182.Sq Li T0000 183.It 184.Sq Li T00 185.It 186.Sq Li 22T 187.It 188.Sq Li \&T 189.It 190.Sq Li \& 191.El 192.Pp 193There is no provision for specification of a timezone. There is 194little point in specifying an explicit minutes or seconds component in 195the current implementation, since the only comparison is `within the 196hour'. 197.It Ar flags 198This optional field specifies if the archive should have any 199special processing done to the archived log files. 200The 201.Ar Z 202flag will make the archive files compress to save space by 203using 204.Xr gzip 1 . 205The 206.Ar B 207flag means that the file is a binary file, and so the 208.Tn ASCII 209message which 210.Nm 211inserts to indicate the fact that the logs have been 212turned over should not be included. The 213.Ar - 214flag means nothing, but can be used as a placeholder when the 215.Ar path_to_pid_file 216field is specified. 217.It Ar path_to_pid_file 218This optional field specifies 219the file name to read to find the daemon process id. If this 220field is present, a 221.Ar signal_number 222is sent the process id contained in this 223file. This field must start with "/" in order to be recognized 224properly. 225.It Ar signal_number 226This optional field specifies 227the signal number will be sent to the daemon process. By default 228a SIGHUP will be sent. 229.El 230.Sh OPTIONS 231The following options can be used with newsyslog: 232.Bl -tag -width indent 233.It Fl f Ar config_file 234Instruct newsyslog to use 235.Ar config_file 236instead of 237.Pa /etc/newsyslog.conf 238for its configuration file. 239.It Fl v 240Place 241.Nm 242in verbose mode. In this mode it will print out each log and its 243reasons for either trimming that log or skipping it. 244.It Fl n 245Cause 246.Nm 247not to trim the logs, but to print out what it would do if this option 248were not specified. 249.It Fl r 250Remove the restriction that 251.Nm 252must be running as root. Of course, 253.Nm 254will not be able to send a HUP signal to 255.Xr syslogd 8 256so this option should only be used in debugging. 257.It Fl F 258Force 259.Nm 260to trim the logs, even if the trim conditions have not been met. This 261option is useful for diagnosing system problems by providing you with 262fresh logs that contain only the problems. 263.El 264.Sh FILES 265.Bl -tag -width /etc/newsyslog.confxxxx -compact 266.It Pa /etc/newsyslog.conf 267.Nm 268configuration file. 269.El 270.Sh BUGS 271Doesn't yet automatically read the logs to find security breaches. 272.Sh AUTHORS 273.An Theodore Ts'o , 274MIT Project Athena 275.Pp 276Copyright 1987, Massachusetts Institute of Technology 277.Sh "SEE ALSO" 278.Xr gzip 1 , 279.Xr syslog 3 , 280.Xr syslogd 8 281