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
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
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
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
- 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
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
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
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
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
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
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
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