[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] syslogd: support external logrotate command
From: Joshua Judson Rosen <jrosen () harvestai ! com>
Date: 2014-05-21 2:01:54
Message-ID: 537C0912.4080906 () harvestai ! com
[Download RAW message or body]
On 2014-05-20 21:45, Joshua Judson Rosen wrote:
> On 2014-05-20 21:12, Joshua Judson Rosen wrote:
>> On 2014-05-20 20:36, Laurent Bercot wrote:
>>>> + IF_FEATURE_LOGROTATE_CMD(
>>>> + if (G.logrotateCmd) {
>>>> + system(G.logrotateCmd);
>>>
>>> It would be a good idea to test the return code of the external
>>> command and schedule a later rotation if it is nonzero.
>>
>> Hmm. I suppose I it could make sense to fall back on doing
>> an internal rotation (or purge) according to G.logFileRotate--
>> rather than just purging. I was concerned about possible
>> mismatches between the internal rotation algorithm and
>> whatever logic might be used by the user-supplied command.
>
> Maybe something more like this?
> [...]
Er..., rather, like this?
@@ -640,7 +659,9 @@ static void log_locally(time_t now, char *msg, logFile_t
*log_file)
#if ENABLE_FEATURE_ROTATE_LOGFILE
if (G.logFileSize && log_file->isRegular && log_file->size > G.logFileSize) {
- if (G.logFileRotate) { /* always 0..99 */
+ if (IF_FEATURE_LOGROTATE_CMD(!(G.logrotateCmd &&
+ system(G.logrotateCmd) == 0) &&)
+ G.logFileRotate) { /* always 0..99 */
int oldname_len = strlen(log_file->path);
#if ENABLE_FEATURE_LOGROTATE_TIMESTAMPS
int i = oldname_len + 1 + 4 + 2 + 2 + 2 + 2 + 2 + 1;
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic