man-pages/man8/savelog.8.html
2021-03-31 01:06:50 +01:00

255 lines
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SAVELOG</TITLE>
</HEAD><BODY>
<H1>SAVELOG</H1>
Section: Maintenance Commands (8)<BR>Updated: 30 Dec 2017<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
savelog - save a log file
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>savelog</B>
[-m mode] [-u user] [-g group] [-t] [-p] [-c cycle] [-l] [-j]
[-J] [-1&nbsp;..&nbsp;-9] [-C] [-d] [-l] [-r rolldir] [-n] [-q] [-D dateformat] file ...
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<B>savelog</B>
command saves and optionally compresses old copies of files. Older versions
of
<I>file</I>
are named:
<DL COMPACT><DT id="1"><DD>
<P>
<I>file</I>.<I>&lt;number&gt;</I><I>&lt;compress_suffix&gt;</I>
<P>
</DL>
where
<I>&lt;number&gt;</I>
is the version number, 0 being the newest. Version numbers &gt; 0 are compressed
unless
<B>-l</B>
prevents it. Version number 0 is not compressed because a process might still
have
<I>file</I>
opened for I/O. Only
<I>cycle</I>
versions of the file are kept.
<P>
If the file does not exist and
<B>-t</B>
was given, it will be created.
<P>
For files that do exist and have lengths greater than zero, the following
actions are performed:
<P>
<DL COMPACT>
<DT id="2">1)<DD>
Version numbered files are cycled. Version
<I>file</I>.<I>2</I>
is moved to version
<I>file</I>.<I>3,</I>
version
<I>file</I>.<I>1</I>
is moved to version
<I>file</I>.<I>2,</I>
and so on. Finally version
<I>file</I>.<I>0</I>
is moved to version
<I>file</I>.<I>1,</I>
and version
<I>file</I>
is deleted. Both
compressed names and uncompressed names are cycled, regardless of
<B>-l</B>.
Missing version files are ignored.
<P>
<DT id="3">2)<DD>
The new
<I>file</I>.<I>1</I>
is compressed unless the
<B>-l</B>
flag was given. It is changed subject to the
<B>-m</B>, <B>-u</B>, and <B>-g</B>
flags.
<P>
<DT id="4">3)<DD>
The main
<I>file</I>
is moved to
<I>file</I>.<I>0.</I>
<P>
<DT id="5">4)<DD>
If the
<B>-m</B>, <B>-u</B>, <B>-g</B>, <B>-t</B>, or <B>-p</B>
flags are given, then an empty
<I>file</I>
is created subject to the given flags. With the
<B>-p</B>
flag, the file is created with the same owner, group, and permissions as
before.
<P>
<DT id="6">5)<DD>
The new
<I>file</I>.<I>0</I>
is changed subject to the
<B>-m</B>, <B>-u</B>, and <B>-g</B>
flags.
<P>
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="7"><B>-m mode</B>
<DD>
chmod the log files to mode, implies
<B>-t</B>
<DT id="8"><B>-u user</B>
<DD>
chown log files to user, implies
<B>-t</B>
<DT id="9"><B>-g group</B>
<DD>
chgrp log files to group, implies
<B>-t</B>
<DT id="10"><B>-c cycle</B>
<DD>
Save cycle versions of the logfile (default: 7). The
<I>cycle</I>
count must be at least 2.
<DT id="11"><B>-t</B>
<DD>
touch new logfile into existence
<DT id="12"><B>-l</B>
<DD>
don't compress any log files (default: do compress)
<DT id="13"><B>-p</B>
<DD>
preserve owner, group, and permissions of logfile
<DT id="14"><B>-j</B>
<DD>
compress with bzip2 instead of gzip
<DT id="15"><B>-J</B>
<DD>
compress with xz instead of gzip
<P>
For xz no strength option is set, and xz decides on the default based on the total amount of physical RAM. Note that xz can use a very large amount of memory for the higher compression levels.
<DT id="16"><B>-1&nbsp;..&nbsp;-9</B>
<DD>
compression strength or memory usage (default: 9, except for xz)
<DT id="17"><B>-C</B>
<DD>
force cleanup of cycled logfiles
<DT id="18"><B>-d</B>
<DD>
use standard date for rolling
<DT id="19"><B>-D dateformat</B>
<DD>
override date format, in the syntax understood by the
<B><A HREF="/cgi-bin/man/man2html?1+date">date</A></B>(1)
command
<DT id="20"><B>-r</B>
<DD>
use
<I>rolldir</I>
instead of . to roll files
<DT id="21"><B>-n</B>
<DD>
do not rotate empty files
<DT id="22"><B>-q</B>
<DD>
be quiet
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>BUGS</H2>
If a process is still writing to
<I>file.0</I>,
and savelog moves it to
<I>file.1</I>
and compresses it, data could be lost.
<P>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?8+logrotate">logrotate</A></B>(8)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="23"><A HREF="#lbAB">NAME</A><DD>
<DT id="24"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="25"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="26"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="27"><A HREF="#lbAF">BUGS</A><DD>
<DT id="28"><A HREF="#lbAG">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:15 GMT, March 31, 2021
</BODY>
</HTML>