Commit Graph

72 Commits

Author SHA1 Message Date
a45cbef86b * support/rotatelogs.c (usage, main): Add support for -c option.
Submitted by: Jan Kaluža <jkaluza redhat.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1189220 13f79535-47bb-0310-9956-ffa450edef68
2011-10-26 13:54:42 +00:00
427c85bd23 Cleanup effort in prep for GA push:
Trim trailing whitespace... no func change



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174751 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 13:39:32 +00:00
01792b69b7 * support/rotatelogs.c (main): Exit with success on EOF.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1140226 13f79535-47bb-0310-9956-ffa450edef68
2011-06-27 16:16:56 +00:00
b3e11effb7 Simplify state handling in rotatelogs, fixing -L support in the case
where open() fails for a new log file.

* support/rotatelogs.c (struct logfile): New structure.
  (struct rotate_status): Store only current logfile state here, using
  struct logfile.
  (close_logfile): Rename from closeFile; assume a valid logfile
  structure is passed in; simplify to use stored filename.
  (checkRotate, main): Adjust for new structure.
  (post_rotate): Adjust, move linkfile handling here.
  (doRotate): Simplify.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1140138 13f79535-47bb-0310-9956-ffa450edef68
2011-06-27 12:29:34 +00:00
550078b731 Tweak rotatelogs -p such that the program is invoked the first time a
new log file is opened as well as for rotations:

* support/rotatelogs.c (usage): Update.
  (post_rotate): Omit third arg if no prev logfile known.
  (doRotate): Invoke even if no previous logfile was open.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1140099 13f79535-47bb-0310-9956-ffa450edef68
2011-06-27 10:57:10 +00:00
0f14fc02dc rotatelogs: Add support for running a custom program after a log
rotation.

* support/rotatelogs.c (post_rotate): New function.
  (usage, dumpConfig): Update.
  (doRotate): Save old filename before rotate; call post_rotate after
  successful rotation.
  (main): Add -p argument.

* docs/manual/programs/rotatelogs.xml: Document -p.

PR: 51285
Submitted by: <sveniu ifi.uio.no>, jorton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1137590 13f79535-47bb-0310-9956-ffa450edef68
2011-06-20 10:28:05 +00:00
74030fa378 rotatelogs: Add -e option to write logs through to stdout for optional
further processing.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1051582 13f79535-47bb-0310-9956-ffa450edef68
2010-12-21 17:52:43 +00:00
6fc811e664 With rotatelogs -v, on platforms where APR_FINFO_NAME is not implemented,
the verbose printf for closing the file never occurred because apr_file_info_get()
always returned APR_INCOMPLETE.  Fix that so we still get a printf with the
information we get back.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1024359 13f79535-47bb-0310-9956-ffa450edef68
2010-10-19 18:57:31 +00:00
39a167fb32 Renamed optarg -> opt_arg to avoid name clashes with system-own optarg;
removed leftover from IDE build times.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1004962 13f79535-47bb-0310-9956-ffa450edef68
2010-10-06 10:05:22 +00:00
81bea55361 Use portable apr_snprintf in rotatelogs.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@917029 13f79535-47bb-0310-9956-ffa450edef68
2010-02-27 19:56:06 +00:00
7335fa4f9e Add -L option to create a hard link to the current log file.
PR: 48761
Submitted by: <lindon orthanc.ca>
With additional changes by: poirier


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@916377 13f79535-47bb-0310-9956-ffa450edef68
2010-02-25 18:00:42 +00:00
78469c61be support/rotatelogs: Support the simplest log rotation case, log
truncation. Useful when the log is being processed in real time
using a command like tail.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@910719 13f79535-47bb-0310-9956-ffa450edef68
2010-02-16 22:01:21 +00:00
60fbe11de1 Bring back OS/2 support.
Reverses r758929 with a little bit of conflict resolution.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@807930 13f79535-47bb-0310-9956-ffa450edef68
2009-08-26 08:56:13 +00:00
ee32468a33 remove OS/2 platform support
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@758929 13f79535-47bb-0310-9956-ffa450edef68
2009-03-26 23:47:52 +00:00
643d77264c Mostly revert r733493: signal based rotation
for rotatelogs.

Prefer adding reliable piped logs to the error
loggers in httpd, so that one could simply
kill rotatelogs and httpd automatically starts new
instances of all loggers.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@734973 13f79535-47bb-0310-9956-ffa450edef68
2009-01-16 11:08:15 +00:00
11587a6fbe Adopt latest changes in usage message.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733532 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 22:52:47 +00:00
618c7592fc Allow size units B, K, M, G and combination of
time and size based rotation for rotatelogs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733531 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 22:45:53 +00:00
fd96906302 rotatelogs: Add flag for verbose (debug) output.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733520 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 21:26:13 +00:00
d26bbe90fe More rotatelogs changes:
- checkRotate() notes the reason for rotation
- rename a few variables
- rename some macros and introduce a few more


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733517 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 20:58:19 +00:00
1f3c946071 Minor rotatelogs changes:
- remove 'now' from status struct. We only need it locally.
- add 'static' to function declaration, although the code
  is still in a single file
- change signature of get_now()
- make argument count check easier to understand


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733513 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 20:27:53 +00:00
091fe50066 Use APR_WANT_STRFUNC and apr_want.h instead
of APR_HAVE_* and system header inclusion.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733495 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 17:48:12 +00:00
d73d0412d5 Allow to trigger rotatelogs log file rotation from
using HUP and INT signals to the rotatelogs process.

This is helpful, when log activity is low, but you want
rotatelogs to close the open log files.

SIGHUP triggers checking the rules given during startup,
SIGINT forces rotate independently form those rules.

When the signal triggers a rotation, the open file
is closed immediately. The new file is opened when
new log data arrives, or in case "-f" was given it
is opened immediately.

Based on my patch in BZ 44427.

Note on Windows: The new functionality is undefined when
SIGHUP or SIGINT are not available. Does the use case
make sense on Windows? If so, which signals should we use?


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733493 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 17:36:07 +00:00
88d19bfcc5 Addition to r733479 and r733479:
Mainly cleanup plus correct decision in checkRotate()
if status->nLogFD is NULL.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733484 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 16:03:57 +00:00
4807369a2c Addition to r744476:
- Fix compilation error
- set correct time when forcing log file open
  on startup


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733479 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 14:44:51 +00:00
29290c61eb Refactor rotatelogs to allow easier implementation
of signal triggered log rotation.

- move code into new functions checkRotate() and doRotate()
- bundle config data and runtime data in two structs to
  allow easier passing to functions
- Simplify bypass_io logic as a first use case for doRotate
  and rename flag to force_open to reflect the new logic



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@733476 13f79535-47bb-0310-9956-ffa450edef68
2009-01-11 14:05:39 +00:00
92c2a85ef4 rotatelogs: Log the current file size and error code/description
when failing to write to the log file. 

Sometimes users have a hard time believing that their little log
file was really big enough to reach quota/filesystem/other limit
back at the time of the error.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@646845 13f79535-47bb-0310-9956-ffa450edef68
2008-04-10 15:33:05 +00:00
a3cd2d0507 Add in new option for rotatelogs: -f
This forces rotatelogs to create the logfile as soon
as started not as soon as it sees it's first line
of input.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@632355 13f79535-47bb-0310-9956-ffa450edef68
2008-02-29 15:32:38 +00:00
9e8ab44160 * Don't leak memory when reopening the logfile.
PR: 40183
Submitted by: rpluem, Takashi Sato <serai lans-tv.com>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@615901 13f79535-47bb-0310-9956-ffa450edef68
2008-01-28 14:51:14 +00:00
5e4bf69196 - when using "-l" reduce two consecutive calls to apr_time_now() to one.
This will not change the logic if no "-l" gets used, and it will spare
  one call to apr_time_now() in case "-l" gets used and more important
  it gives the code better atomicity, because in fact between the two calls
  there is a slight change of jumping oder the DST boundary

- for historic reasons the same code block is used two times with a
  slightly different way of transforming apr_time_t to int
  (once division by APR_USEC_PER_SEC, once call to apr_time_sec()),
  so let's unify it.

- finally move the block into a function, because it gets used already
  two times.

PR: 44004
Submitted by: Rainer Jung <rainer.jung kippdata.de>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@600154 13f79535-47bb-0310-9956-ffa450edef68
2007-12-01 16:14:21 +00:00
7daf1c58a9 Allow local timestamps to be used when rotating based on file size.
IOW, accept and respect either -l or UTC offset when rotating
based on file size.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@596796 13f79535-47bb-0310-9956-ffa450edef68
2007-11-20 19:38:13 +00:00
23cd4abf23 improve command-line parsing
example invocations now flagged as invalid:
  specifying UTC offset with size-based rotation
  specifying -l with size-based rotation
  specifying both -l and UTC offset

range checking of integer parameters not attempted; basic data type issues may need
to be addressed first such as the use of unsigned int for max file size


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@596698 13f79535-47bb-0310-9956-ffa450edef68
2007-11-20 14:46:52 +00:00
8c6dad6c41 increase size of error string buffer passed to apr_strerror();
120 is the size most frequently used in Apache; APR provides no
hints


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@485828 13f79535-47bb-0310-9956-ffa450edef68
2006-12-11 19:08:40 +00:00
a812d1a0cc * support/rotatelogs.c (main): Produce useful error message for open()
failures.

PR: 39487


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@478135 13f79535-47bb-0310-9956-ffa450edef68
2006-11-22 11:48:55 +00:00
de659cbed0 update license header text
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@420983 13f79535-47bb-0310-9956-ffa450edef68
2006-07-11 20:33:53 +00:00
dd95d7c37c Update the copyright year in all .c, .h and .xml files
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@395228 13f79535-47bb-0310-9956-ffa450edef68
2006-04-19 12:11:27 +00:00
5061d9fa92 No functional Change: Removing trailing whitespace. This also
means that "blank" lines consisting of just spaces or
tabs are now really blank lines


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332306 13f79535-47bb-0310-9956-ffa450edef68
2005-11-10 15:11:44 +00:00
905cdf9f0b Update copyright year to 2005 and standardize on current copyright owner line.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@151408 13f79535-47bb-0310-9956-ffa450edef68
2005-02-04 20:28:49 +00:00
4f3d5516c5 make the check for GMT offset occur each time through the loop,
in case a switch between standard and daylight savings time
	occurred.  (correction to previous code courtesy of Uli Zappe.)

PR:		24417
Submitted by:	Uli Zappe <uli ritual.org>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103973 13f79535-47bb-0310-9956-ffa450edef68
2004-06-16 21:27:06 +00:00
784e460e3d oops; left over from an earlier version
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103945 13f79535-47bb-0310-9956-ffa450edef68
2004-06-14 17:02:54 +00:00
0979b2042f add "-l" option to indicate interval is based on localtime not gmt
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103921 13f79535-47bb-0310-9956-ffa450edef68
2004-06-11 21:43:58 +00:00
eeb57c17ad fix name of The Apache Software Foundation
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102619 13f79535-47bb-0310-9956-ffa450edef68
2004-02-09 20:40:53 +00:00
c0dcb76491 fix copyright dates according the first cehck in
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102592 13f79535-47bb-0310-9956-ffa450edef68
2004-02-08 14:14:53 +00:00
4f02cb1e18 apply Apache License, Version 2.0
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102525 13f79535-47bb-0310-9956-ffa450edef68
2004-02-06 22:58:42 +00:00
fb07607180 update license to 2004.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102135 13f79535-47bb-0310-9956-ffa450edef68
2004-01-01 13:26:26 +00:00
742af25096 finished that boring job:
update license to 2003.

Happy New Year! ;-))


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98573 13f79535-47bb-0310-9956-ffa450edef68
2003-02-03 17:53:28 +00:00
12f572f037 Axe some warnings in rotatelogs which came when the program was
converted to use APR.  The behaviors of apr_file_read() and
apr_file_write() weren't taken completely into account.

But note: In a couple of places the check "nRead < 0" was removed.
          While that is meaningless with APR and hasn't done anything
          useful in a long time, in Apache 1.3 days it was essentially
          a check for read-failed-with-EINTR.  Apparently a rotation
          would occur if the read was interrupted by a signal.  That
          function has been lost with the APR-ization.

PR:              12617


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97570 13f79535-47bb-0310-9956-ffa450edef68
2002-11-20 00:09:56 +00:00
8a5c5d303e Cleanup some type mismatch emits and consistify to our new apr time helpers
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95675 13f79535-47bb-0310-9956-ffa450edef68
2002-06-14 17:16:03 +00:00
144263d52f Just quiet an annoying warning.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95645 13f79535-47bb-0310-9956-ffa450edef68
2002-06-13 16:36:54 +00:00
689fc8157f Added log rotation based on file size to the RotateLog support utility.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95619 13f79535-47bb-0310-9956-ffa450edef68
2002-06-12 21:46:50 +00:00
00e4bee8a8 Oops, found another typo
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95614 13f79535-47bb-0310-9956-ffa450edef68
2002-06-11 19:02:02 +00:00