summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog
Commit message (Collapse)AuthorAgeFilesLines
* Major re-ordering of the steps that newsyslog will use when processinggad2004-06-071-0/+425
| | | | | | | | | | | | | | | | | | | | | | | | | files to rotate. The new order will first rotate all files that need to be rotated, and then send a single signal to each process which needs to be signaled, and finally it will compress all the files which were rotated. This means daemons will be signaled once per run of newsyslog, instead of once per file rotated. Also, files will be compressed in order of file-size (smallest to largest). Also, it waits for each file to be completely compressed before starting the next one (effectively as if the 'w' flag is specified for all entries in newsyslog.conf). This avoids the situation of having 10 gzip's going at the same time (each with a log.0 and a log.0.gz file active), and it also means that file attributes can be reliably set on files after they are compressed. NOTE: This commit does define NEWORDER (which you could get rid of if you really don't trust this), but it does not flip the "-D neworder" switch. So, at the moment none of these changes happen unless you request them (perhaps by adding '<debug> neworder' in newsyslog.conf). PR: bin/25070 inspired some parts of this Submitted by: parts from bin/25070 done by Helge Oldach MFC after: 14 days
* A variety of minor changes. Allow users to set a debugging option viagad2004-06-071-67/+120
| | | | | | | | | | | | | | | the newsyslog.conf file. Rename one size-related variable, and move another one from the stack into conf_entry. Add a routine to change file-attributes (chown, chmod, chflags), instead of having several places doing the same sequence of system-calls. A few cosmetic/style changes. These should not effect any users. Most of these probably look pointless, but they are the "insignificant parts" of a much larger update that I'll be committing soon. Doing these as a separate update should make that update easier to read. MFC after: 14 days
* Style-istic fix to a number of #define's that were not followed by a tab...gad2004-06-031-16/+16
| | | | MFC after: 16 days
* Add a 'D' flag that can be specified on entries in newsyslog.conf.gad2004-06-032-1/+41
| | | | | | | | If specified, the matching log files will have the NODUMP flag set on them after they are created. Submitted by: Sean Eric Fagan MFC after: 16 days
* Change standard processing to use the newer createlog() routinegad2004-06-031-56/+33
| | | | | | | | that had been written some months ago for other processing. This should get rid of a few subtle situations where an existing log file would not exist (for a short time) while it is being rotated. MFC after: 16 days
* Improved versions of the is*ch() and tolowerch() macros that I like to use.gad2004-06-021-7/+7
|
* When rotating some "blah.log" file, make sure that a chmod andgad2004-06-021-13/+14
| | | | | | | | (if requested) a chown is done on the "blah.log.0" file. PR: bin/67137 Submitted by: jeh MFC after: 10 days
* Do not :-terminate err(3) string, one will be added anyway.charnier2004-04-041-1/+1
|
* Move newsyslog.conf.5 to usr.sbin/newsyslog. There is no real historytrhodes2004-03-122-1/+371
| | | | | | other than 'initial revision' thus I did not request a repocopy. Requested by: ru, gad
* Remove information about the configuration file.trhodes2004-03-111-308/+3
| | | | Add an Xref to newsyslog.conf.5 and bzip2.1.
* Handle a 'const' parameter without using __DECONST().gad2003-10-041-8/+14
| | | | MFC after: 14 days
* Restructure the time processing routines, mainly to fix up thegad2003-09-233-85/+480
| | | | | | | | | | "will trim at" message printed when the user requests '-v'. The previous code would often print the wrong time, such as: On Sept 22, run: newsyslog -nv /var/log/wtmp And see: will trim at Mon Sep 1 05:00:00 2003 correct msg: will trim at Wed Oct 1 05:00:00 2003 MFC after: 20 days
* Correct the calculation of "a leap year" in parseDWM. The calculationgad2003-09-141-17/+43
| | | | | | | | would only match a leap year every 400 years. The parseDWM code first showed up in April 2000, so the first time this bug would cause any confusion is in Feb 2004. MFC after: 18 days
* Move the parse8601 and parseDWM routines into a new ptime.c file. Thegad2003-09-124-219/+320
| | | | | | | only code-change is to add a "next_time" parameter to both routines (and that is not used yet). A later update will make "next_time" more useful. MFC after: 20 days
* Switch dotrim() to take advantage of the 'struct conf_entry' thatgad2003-09-091-33/+36
| | | | | | | is already passed in, instead of having the caller copy values from that struct into additional parameters. MFC after: 22 days
* Reduce the annoying compiler warnings that pop up when compiling withgad2003-09-091-9/+9
| | | | | | gcc 3.3.x and -Wshadow. Just renames 'log' variables to be 'logname'. MFC after: 22 days
* Correct the comment about which timezone-change loses an hour...gad2003-09-091-2/+2
| | | | MFC after: 23 days
* Add a '-D <something>' command line arg, which can be used to setgad2003-09-091-3/+57
| | | | | | | | debugging options. Initial option is '-D TN=<time>', which can be used to see how newsyslog would work if run at the specified time. (time format is ISO 8601, since that is already supported). MFC after: 23 days
* Use strtol() instead of strtoul() in parse8601, so we can detectgad2003-09-091-17/+17
| | | | | | | negative values. Mainly done to sync this routine with OpenBSD. Obtained from: OpenBSD MFC after: 23 days
* Fix typo in the previous commit. Was checking wrong variable...gad2003-09-091-1/+1
| | | | MFC after: 23 days
* Change parse8601 and parseDWM so they return an alternate error valuegad2003-09-091-14/+29
| | | | | | for invalid times, and have the caller print the error message. MFC after: 23 days
* Cosmetic change to move parse8601 right next to parseDWM. No codegad2003-09-091-86/+86
| | | | | | is changed. (that will come in later updates). MFC after: 23 days
* When checking the 'user:group' field in newsyslog.conf, freebsd's sourcegad2003-08-191-2/+14
| | | | | | | | | | | | | | | | | | | | | | was mistakenly calling the standard isnumber() function to find out if the given 'user' or 'group' were all numeric. This meant that only the first character of the fields were actually checked, so a username of (say) '3com' would look like a number, and thus get mapped to uid=3 (bin) instead of username=3com. This bug was introduced back in freebsd's v1.1. That initial import almost matches netbsd's v1.9, except that an internal isnumber() routine was removed in favor of the standard library version. The thing is, that internal routine was checking the entire string, and not just the first digit. In OpenBSD, isnumber() was eventually renamed to isnumberstr() to make the distinction more obvious, and I'm going to follow that lead. I believe this also happens to remove the last references to isnumber() in the entire freebsd base system. Obtained from: OpenBSD, by a long circuitous route MFC after: 5 days
* Fix an 'bad file descriptor' error which would come up when usinggad2003-08-021-1/+0
| | | | | | | the 'C' flag on an entry that also specifies 'user:group' info. Submitted by: Riccardo Torrini <riccardo@torrini.org> in -current MFC after: 4 days
* Fix age_old_log checking so that it will notice log files which weregad2003-05-051-4/+19
| | | | | | | | | | rotated and then compressed with bzip2 instead of gzip. Otherwise, any file which had a time-interval specified for 'when' and also specified the 'J' flag would be rotated every time newsyslog was run. (this is a quick-fix, trying to beat the code-freeze for 5.1-release) PR: bin/51519 MFC after: 1 week
* Slightly improve the checking of the 'size' field, so people will getgad2003-05-051-2/+8
| | | | | | a warning message if they switch the values for 'size' and 'when'. MFC after: 1 week
* Use __FBSDID over rcsid[]. Protect copyright[] where needed.obrien2003-05-031-4/+2
|
* Add a -C (create) option for newsyslog, and a 'C' flag for entries in thegad2003-04-272-20/+190
| | | | | | | | | | config file. If the -C option is specified once, then newsyslog will create any entries which specify the 'C' option. If -C is given twice, then newsyslog will create all missing log files. Some of this code comes from NetBSD, although this implementation does not exactly match theirs. Reviewed by: freebsd-arch MFC after: 10 days
* Document support for the new 'U' flag, which was implemented back in Marchgad2003-04-241-6/+17
| | | | | | as revision 1.64 of newsyslog.c. I plan to MFC these changes next week. MFC after: 1 week
* Document support for the new -s and -R command-line options, andgad2003-04-241-51/+124
| | | | | | | | | | | the 'N' flag. These were coded in March as revisions 1.55 and 1.56 of newsyslog.c. I intend to MFC all the matching changes next week. This also reorganizes the description of the 'flags' field to give list of the valid flags, instead of a long paragraph explaining each of the possible values. Obtained from: NetBSD (in spirit at least, for -s and N) MFC after: 1 week
* Document support for the <default> entry, which was implemented ingad2003-04-231-2/+8
| | | | | | | revision 1.50 of newsyslog.c , back in February. I intend to MFC those changes soon. MFC after: 4 days
* Fix interactions between entries for a specific file vs entries forgad2003-03-091-62/+177
| | | | | | | | | a filename pattern, and also wrt filenames given on the command line. Now if a file is listed as a specific entry, it will not *also* be processed by an entry specifying a pattern. And filename-patterns will now only match existing files (ignoring directories, etc). MFC after: 3 weeks
* The processing of files given on the command-line will work a little bettergad2003-03-091-1/+1
| | | | | | | if we return the entire worklist, instead of just the last entry. A minor fix to revision 1.57. MFC after: 15 days
* Add a config-file flag of 'U' or 'u' to indicate that the pid-filegad2003-03-081-46/+115
| | | | | | | | | | | | | | | will contain the pid for a process group. This means the file must contain a negative value (as would be needed in the 'kill' commmand). I still need to write man-page update before MFC-ing. This started by rewriting the get_pid() routine. Later I looked at what OpenBSD has, and included a few ideas from their send_signal() routine. So, parts of this change are from OpenBSD, even though OpenBSD does not actually have a 'U' flag. PR: bin/28435 Reviewed by: no objections on freebsd-arch MFC after: 3 weeks
* Prefix all -n (noaction) "unix cmds" with tab, thus making it much easiergad2003-03-071-19/+24
| | | | | | | | to sort out noaction messages from -v (verbose) messages. This also improves a few noaction messages. Obtained from: OpenBSD MFC after: 3 weeks
* Move the -s (nosignal) processing, as newsyslog needs to print out agad2003-03-071-11/+14
| | | | | | | | | | warning message if -s is specified and it rotates a file that expects to be compressed. This warning message is not printed if -R is also specified, because we assume a -sR request is coming from the process which would have been signaled, and that it has already released the logfile. Indirectly noticed by: sheldonh
* Add missing 'static' on two routines, so they match their declarations.gad2003-03-031-2/+2
| | | | | | PR: 29363 (a small part of) Submitted by: dinoex MFC after: 3 weeks
* A variety of cosmetic changes, mostly to (slightly) reduce diffs withgad2003-03-031-29/+29
| | | | | | OpenBSD. Except for one added '\n', the object code is not changed. MFC after: 3 weeks
* Collapse two more parameters to dotrim() into the 'ent' parameter that isgad2003-03-031-13/+12
| | | | | | already there. This should not effect anything. MFC after: 3 weeks
* Change to using uid_t and gid_t instead of int. Also change this won'tgad2003-03-031-42/+37
| | | | | | | bother doing a chmod() if neither of these two fields are set. Obtained from: OpenBSD MFC after: 3 weeks
* Fix the interactions between specific log files given on the command line,gad2003-03-031-106/+186
| | | | | | | | | and config-file entries which specify a filename-pattern (glob). It is still not perfectly-right, but at least it isn't completely-wrong. Reviewed by: no objections on freebsd-arch MFC after: 3 weeks MFC addendum: (or after the code-freeze of 4.x is lifted)
* Add a command-line option of '-R somename', which indicates that newsysloggad2003-03-021-9/+77
| | | | | | | | | | | | | should rotate all files given on the command, even if they don't seem to need to be rotated. This would be used by some other command that decides the given log file(s) should be rotated, but wants the "how" of that rotation to be determined by entries to newsyslog. Wes expects to change syslogd to take advantage of this. Man page will be updated after we're sure this is all working the way we want it to. Reviewed by: no objections on freebsd-arch MFC after: 3 weeks MFC addendum: (or after the code-freeze of 4.x is lifted)
* Add a command-line option of '-s', which indicates that newsyslog shouldgad2003-03-021-50/+120
| | | | | | | | | | | | not send a signal to any processes. Also add a config-file flag of 'N' or 'n', which indicates that the given logfile has no process which needs a signal when it is rotated. Both of these are based on changes NetBSD has made, although the implementation is somewhat different. PR: bin/36553 (2nd half) Reviewed by: no objections on freebsd-arch Obtained from: NetBSD (in spirit, at least) MFC after: 3 weeks
* Fix an error which caused 'free(): error: chunk is already free'gad2003-02-261-0/+3
| | | | | | if an entry in the config file included flag 'G'. MFC after: 3 weeks
* Check the value given for number-of-logs to keep in config-file entries,gad2003-02-241-2/+2
| | | | | | | and error-out if the value is negative (avoiding an infinite loop). PR: bin/30654 (part of it) MFC after: 3 weeks
* 1) Fix so -a honors the -n ("do nothing") option. Before, if the directorygad2003-02-241-4/+16
| | | | | | | | | | given for -a did not exist, then newsyslog would always try to create it, even if -n was specified. 2) When -a processing *does* create the directory, have it check the result from mkdir(), and immediately error-out if that failed. PR: bin/46974 MFC after: 3 weeks
* Minor style fix. Add parenthesis around 'return' values.gad2003-02-241-16/+16
| | | | | Reviewed by: md5 MFC after: 3 weeks
* Add the idea of a "default rotate action", which will be used if a file isgad2003-02-241-33/+194
| | | | | | | | | | | specified at runtime, but that filename is not listed in the newsyslog.conf file. This default-action can be changed by having a line in newsyslog.conf with the filename of "<default>". Before this change, the program would quietly ignore the given file. An update to the man page will be written after I finish some other updates to newsyslog.c. Reviewed by: no objections from freebsd-arch MFC after: 3 weeks
* english(4) police.schweikh2002-12-271-2/+2
|
* Make newsyslog(8) print the correct date when the logs are turned over.trhodes2002-12-211-2/+2
| | | | | | PR: 46395 Submitted by: maxim MFC: eventually
OpenPOWER on IntegriCloud