1.\" This file was split from the newsyslog(8) manual page by Tom Rhodes 2.\" and includes modifications as appropriate. 3.\" The original header is included below: 4.\" 5.\" This file contains changes from the Open Software Foundation. 6.\" 7.\" Copyright 1988, 1989 by the Massachusetts Institute of Technology 8.\" 9.\" Permission to use, copy, modify, and distribute this software 10.\" and its documentation for any purpose and without fee is 11.\" hereby granted, provided that the above copyright notice 12.\" appear in all copies and that both that copyright notice and 13.\" this permission notice appear in supporting documentation, 14.\" and that the names of M.I.T. and the M.I.T. S.I.P.B. not be 15.\" used in advertising or publicity pertaining to distribution 16.\" of the software without specific, written prior permission. 17.\" M.I.T. and the M.I.T. S.I.P.B. make no representations about 18.\" the suitability of this software for any purpose. It is 19.\" provided "as is" without express or implied warranty. 20.\" 21.Dd September 1, 2025 22.Dt NEWSYSLOG.CONF 5 23.Os 24.Sh NAME 25.Nm newsyslog.conf 26.Nd 27.Xr newsyslog 8 28configuration file 29.Sh DESCRIPTION 30The 31.Nm 32file is used to set log file rotation configuration for the 33.Xr newsyslog 8 34utility. 35Configuration may designate that logs are rotated based on 36size, last rotation time, or time of day. 37The 38.Nm 39file can also be used to designate secure permissions to log 40files at rotation time. 41During initialization, 42.Xr newsyslog 8 43reads a configuration file, 44normally 45.Pa /etc/newsyslog.conf , 46to determine which logs may potentially be rotated and archived. 47.Pp 48Blank lines or lines beginning with 49.Ql # 50are ignored. 51If 52.Ql # 53is placed in the middle of the line, the 54.Ql # 55character and the rest of the line after it is ignored. 56To prevent special meaning, the 57.Ql # 58character may be escaped with 59.Ql \e ; 60in this case preceding 61.Ql \e 62is removed and 63.Ql # 64is treated as an ordinary character. 65.Pp 66The special 67.Dq Ar <compress> 68and 69.Dq Ar <include> 70lines are defined as follows: 71.Bl -tag -width indent 72.It Ar <compress> Ar none Ns | Ns Ar legacy Ns | Ns Ar bzip2 Ns | Ns Ar gzip Ns | Ns Ar xz Ns | Ns Ar zstd 73This special option sets the global compress method, 74it should be placed before all log file entries in 75.Nm 76configuration file. 77The global compress method applies to all log files flagged as 78compressible 79.Dq Sy J , 80.Dq Sy X , 81.Dq Sy Y , 82.Dq Sy Z 83.Ar flags 84below. 85.Pp 86The following compression methods are available: 87.Bl -tag -width indent 88.It Cm none 89No compression is performed, even when a log file is marked as 90compressible. This is useful for filesystems that have native 91compression support. 92.It Cm legacy 93Interprets the 94.Sy J, X, Y, Z 95flags in the configuration file according to their historical meanings. 96This is the default method. 97.It Cm bzip2 98Use 99.Xr bzip2 1 100for all compressible log files. 101.It Cm gzip 102Use 103.Xr gzip 1 104for all compressible log files. 105.It Cm xz 106Use 107.Xr xz 1 108for all compressible log files. 109.It Cm zstd 110Use 111.Xr zstd 1 112for all compressible log files. 113.El 114.It Ar <include> 115The special <include> entry is used to include other configuration 116files and supports globbing. 117.El 118.Pp 119Each other line has five mandatory fields and four optional fields, 120separated with whitespace. 121The fields of the configuration file are as follows: 122.Bl -tag -width indent 123.It Ar logfile_name 124Name of the system log file to be archived, 125or the special string 126.Dq Ar <default> . 127The special <default> entry will only be used if a log file 128name is given as a command line argument to 129.Xr newsyslog 8 , 130and if that log file name is not matched by any other 131line in the configuration file. 132.It Ar owner : Ns Ar group 133This optional field specifies the owner and group for the archive file. 134The 135.Ql \&: 136is essential regardless if the 137.Ar owner 138or 139.Ar group 140field is left blank or contains a value. 141The field may be numeric, or a name which is present in 142.Pa /etc/passwd 143or 144.Pa /etc/group . 145.It Ar mode 146Specify the file mode of the log file and archives. 147Valid mode bits are 148.Dv 0666 . 149(That is, read and write permissions for the rotated log may be specified for 150the owner, group, and others.) 151All other mode bits are ignored. 152.It Ar count 153Specify the maximum number of archive files which may exist. 154This does not consider the current log file. 155.It Ar size 156When the size of the log file reaches 157.Ar size , 158in kilobytes by default, or with suffixes like k, M, G, ... as supported by 159.Xr expand_number 3 , 160the log file will be trimmed as described above. 161If this field contains an asterisk 162.Pq Ql * , 163the log file will not be trimmed based on size. 164.It Ar when 165The 166.Ar when 167field may consist of an interval, a specific time, or both. 168If the 169.Ar when 170field contains an asterisk 171.Pq Ql * , 172log rotation will solely depend on the contents of the 173.Ar size 174field. 175Otherwise, the 176.Ar when 177field consists of an optional interval in hours, usually followed 178by an 179.So Li \&@ Sc Ns No -sign 180and a time in restricted 181.Tn ISO 8601 182format. 183Additionally, the format may also be constructed with a 184.Ql $ 185sign along with a rotation time specification of once 186a day, once a week, or once a month. 187.Pp 188Time based trimming happens only if 189.Xr newsyslog 8 190is run within one hour of the specified time. 191If an interval is specified, the log file will be trimmed if that many 192hours have passed since the last rotation. 193When both a time and an interval are 194specified then both conditions must be satisfied for the rotation to 195take place. 196.Pp 197There is no provision for the specification of a timezone. 198There is little point in specifying an explicit minutes or 199seconds component in the current implementation, since the only comparison is 200.Dq within the hour . 201.Pp 202.Sy ISO 8601 restricted time format : 203.Pp 204The lead-in character for a restricted 205.Tn ISO 8601 206time is an 207.Ql @ 208sign. 209The particular format of the time in restricted 210.Tn ISO 8601 211is: 212.Sm off 213.Oo Oo Oo Oo Oo 214.Va cc Oc 215.Va yy Oc 216.Va mm Oc 217.Va dd Oc 218.Oo 219.Li T Oo 220.Va hh Oo 221.Va mm Oo 222.Va ss 223.Oc Oc Oc Oc Oc . 224.Sm on 225Optional date fields default to the appropriate component of the 226current date; optional time fields default to midnight; hence if today 227is January 22, 1999, the following date specifications are all 228equivalent: 229.Pp 230.Bl -item -compact -offset indent 231.It 232.Sq Li 19990122T000000 233.It 234.Sq Li 990122T000000 235.It 236.Sq Li 0122T000000 237.It 238.Sq Li 22T000000 239.It 240.Sq Li T000000 241.It 242.Sq Li T0000 243.It 244.Sq Li T00 245.It 246.Sq Li 22T 247.It 248.Sq Li T 249.It 250.Sq Li \& 251.El 252.Pp 253.Sy Day, week, and month time format: 254.Pp 255The lead-in character for day, week, and month specification is a 256.Ql $ 257sign. 258The particular format of day, week, and month specification is: 259.Op Li D Ns Va hh , 260.Op Li W Ns Va w Ns Op Li D Ns Va hh , 261and 262.Op Li M Ns Va dd Ns Op Li D Ns Va hh , 263respectively. 264Optional time fields default to midnight. 265The ranges for day and hour specifications are: 266.Pp 267.Bl -tag -width indent -offset indent -compact 268.It Ar hh 269hours, range 0..23 270.It Ar w 271day of week, range 0..6, 0 = Sunday 272.It Ar dd 273day of month, range 1..31, or one of the letters 274.Ql L 275or 276.Ql l 277to specify the last day of the month. 278.El 279.Pp 280Some examples: 281.Pp 282.Bl -tag -width indent -offset indent -compact 283.It Li $D0 284rotate every night at midnight 285(same as 286.Li @T00 ) 287.It Li $D23 288rotate every day at 23:00 289(same as 290.Li @T23 ) 291.It Li $W0D23 292rotate every week on Sunday at 23:00 293.It Li $W5D16 294rotate every week on Friday at 16:00 295.It Li $M1D0 296rotate at the first day of every month at midnight 297(i.e., the start of the day; same as 298.Li @01T00 ) 299.It Li $M5D6 300rotate on every fifth day of month at 6:00 301(same as 302.Li @05T06 ) 303.El 304.It Ar flags 305This optional field is made up of one or more characters 306that specify any special processing to be done for the log 307files matched by this line. 308The following are valid flags: 309.Bl -tag -width indent 310.It Cm B 311indicates that the log file is a binary file, or has some 312special format. 313Usually 314.Xr newsyslog 8 315inserts an 316.Tn ASCII 317message into a log file during rotation. 318This message is used to indicate 319when, and sometimes why the log file was rotated. 320If 321.Cm B 322is specified, then that informational message will not be 323inserted into the log file. 324.It Cm C 325indicates that the log file should be created if it does not 326already exist, and if the 327.Fl C 328option was also specified on the command line. 329.It Cm D 330indicates that 331.Xr newsyslog 8 332should set the 333.Dv UF_NODUMP 334flag when creating a new version of 335this log file. 336This option would affect how the 337.Xr dump 8 338command treats the log file when making a file system backup. 339.It Cm E 340indicates that the log file should not be rotated when its 341size is zero. 342The 343.Cm E 344flag is mostly useful in conjunction with 345.Cm B 346flag to prevent 347.Xr newsyslog 8 348from inserting an informational 349.Tn ASCII 350message into the new file. 351.It Cm G 352indicates that the specified 353.Ar logfile_name 354is a shell pattern, and that 355.Xr newsyslog 8 356should archive all filenames matching that pattern using the 357other options on this line. 358See 359.Xr glob 3 360for details on syntax and matching rules. 361.It Cm J 362indicates that 363.Xr newsyslog 8 364should consider the rotated log file as compressible. 365In legacy mode, 366this also tells 367.Xr newsyslog 8 368to use 369.Xr bzip2 1 . 370.It Cm N 371indicates that there is no process which needs to be signaled 372when this log file is rotated. 373.It Cm P 374indicates that the zero-th rotated file should not be compressed. 375.It Cm R 376if this flag is set the 377.Xr newsyslog 8 378will run shell command defined in 379.Ar path_to_pid_cmd_file 380after rotation instead of trying to send signal to a process id 381stored in the file. 382.It Cm T 383if this flag is set the informational rotation message written to 384the log file will be in the format specified by RFC5424. 385Normally, the rotation message is written in the traditional (RFC3164) 386syslog format. 387.It Cm U 388indicates that the file specified by 389.Ar path_to_pid_cmd_file 390will contain the ID for a process group instead of a process. 391This option also requires that the first line in that file 392be a negative value to distinguish it from a process ID. 393.It Cm X 394indicates that 395.Xr newsyslog 8 396should consider the rotated log file as compressible. 397In legacy mode, 398this also tells 399.Xr newsyslog 8 400to use 401.Xr xz 1 . 402.It Cm Y 403indicates that 404.Xr newsyslog 8 405should consider the rotated log file as compressible. 406In legacy mode, 407this also tells 408.Xr newsyslog 8 409to use 410.Xr zstd 1 . 411.It Cm Z 412indicates that 413.Xr newsyslog 8 414should consider the rotated log file as compressible. 415In legacy mode, 416this also tells 417.Xr newsyslog 8 418to use 419.Xr gzip 1 . 420.It Fl 421a minus sign will not cause any special processing, but it 422can be used as a placeholder to create a 423.Ar flags 424field when you need to specify any of the following fields. 425.El 426.It Ar path_to_pid_cmd_file 427This optional field specifies the file name containing a daemon's 428process ID or to find a group process ID if the 429.Cm U 430flag was specified. 431If this field is present, a 432.Ar signal 433is sent to the process ID contained in this file. 434If this field is not present and the 435.Cm N 436flag has not been specified, then a 437.Dv SIGHUP 438signal will be sent to 439.Xr syslogd 8 440or to the process id found in the file specified by 441.Xr newsyslog 8 Ns 's 442.Fl S 443switch. 444This field must start with 445.Ql / 446in order to be recognized properly. 447When used with the 448.Cm R 449flag, the file is treated as a path to a binary to be executed 450by the 451.Xr newsyslog 8 452after rotation instead of sending the signal out. 453.It Ar signal 454This optional field specifies the signal that will be sent to the daemon 455process (or to all processes in a process group, if the 456.Cm U 457flag was specified). 458If this field is not present, then a 459.Dv SIGHUP 460signal will be sent. 461Signal names 462must start with 463.Dq SIG 464and be the signal name, e.g., 465.Dv SIGUSR1 . 466Alternatively, 467.Ar signal 468can be the signal number, e.g., 30 for 469.Dv SIGUSR1 . 470.El 471.Sh EXAMPLES 472The following is an example of the 473.Dq <include> 474entry: 475.Dl "<include> /etc/newsyslog-local.conf" 476.Sh SEE ALSO 477.Xr bzip2 1 , 478.Xr gzip 1 , 479.Xr xz 1 , 480.Xr zstd 1 , 481.Xr expand_number 3 , 482.Xr syslog 3 , 483.Xr chown 8 , 484.Xr newsyslog 8 , 485.Xr syslogd 8 486.Pp 487.Rs 488.%A C. Lonvick 489.%T The BSD syslog Protocol 490.%O RFC3164 491.Re 492.Rs 493.%A R. Gerhards 494.%T The Syslog Protocol 495.%O RFC5424 496.Re 497.Sh HISTORY 498This manual page first appeared in 499.Fx 4.10 . 500