aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/newsyslog/newsyslog.8
diff options
context:
space:
mode:
authorSimon L. B. Nielsen <simon@FreeBSD.org>2010-07-22 11:23:18 +0000
committerSimon L. B. Nielsen <simon@FreeBSD.org>2010-07-22 11:23:18 +0000
commit872e964d07d1a3683bd44e845c17cad5ef67291a (patch)
treefab913587ea8dac1adf047fc3f4e1b3cef675e56 /usr.sbin/newsyslog/newsyslog.8
parentf4e7c5a894efbbaae4c8da90d4c6a45eebad86df (diff)
downloadsrc-872e964d07d1a3683bd44e845c17cad5ef67291a.tar.gz
src-872e964d07d1a3683bd44e845c17cad5ef67291a.zip
Add support for creating the archived log filenames using a time-stamp
instead of the traditional simple counter. Using the time-stamp based file-names, once a log file is archived, it will not change name until it is deleted. This means that many backup systems will only perform one backup of the archived log file, instead for performing a new backup of the logfile upon each logfile rotation. This implementation is separate from the patches in the mentioned PR, as I wasn't aware of the existence of the PR until after I had implemented the same functionality as the patches in the PR provide. Unlike the PR, this new code does honor the 'log count' in newsyslog.conf so old logfiles are deleted. This new code does not currently support never deleting the archived logfiles. PR: bin/29363 MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=210372
Diffstat (limited to 'usr.sbin/newsyslog/newsyslog.8')
-rw-r--r--usr.sbin/newsyslog/newsyslog.831
1 files changed, 31 insertions, 0 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.8 b/usr.sbin/newsyslog/newsyslog.8
index 19d01d7f6022..58881a2d5dae 100644
--- a/usr.sbin/newsyslog/newsyslog.8
+++ b/usr.sbin/newsyslog/newsyslog.8
@@ -30,6 +30,7 @@
.Op Fl a Ar directory
.Op Fl d Ar directory
.Op Fl f Ar config_file
+.Op Fl t Ar timefmt
.Op Ar
.Sh DESCRIPTION
The
@@ -50,6 +51,11 @@ the last period's logs in it,
has the next to last
period's logs in it, and so on, up to a user-specified number of
archived logs.
+It is also possible to let archived log filenames be created using the
+time the log file was archived instead of the sequential number using
+the
+.Fl t
+option.
Optionally the archived logs can be compressed to save
space.
.Pp
@@ -141,6 +147,31 @@ However, this option is most likely to be useful when specified
with the
.Fl R
option, and in that case the compression will be done.
+.It Fl t Ar timefmt
+If specified
+.Nm
+will create the
+.Dq rotated
+logfiles using the specified time format instead of the default
+sequential filenames.
+The time format is described in the
+.Xr strftime 3
+manual page.
+If the
+.Ar timefmt
+argument is set to an empty string or the string
+.Dq DEFAULT ,
+the default built in time format
+is used.
+If the
+.Ar timefmt
+string is changed the old files created using the previous time format
+will not be 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.
.It Fl C
If specified once, then
.Nm