On Wednesday 06 June 2012 06:07, Danomi Manchego wrote:
> Signed-off-by: Danomi Manchego <[email protected]>
> ---
>  sysklogd/Config.src |    7 +++++++
>  sysklogd/syslogd.c  |   23 ++++++++++++++++++++++-
>  2 files changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/sysklogd/Config.src b/sysklogd/Config.src
> index b7a494e..5ca86f4 100644
> --- a/sysklogd/Config.src
> +++ b/sysklogd/Config.src
> @@ -30,6 +30,13 @@ config FEATURE_ROTATE_LOGFILE
>         This enables syslogd to rotate the message files
>         on his own. No need to use an external rotatescript.
>  
> +config FEATURE_GZIP_ROTATED_LOGFILE
> +     bool "Gzip rotated message files"
> +     default n
> +     depends on GZIP && SYSLOGD
> +     help
> +       Compress rotated message files using gzip.
> +

It should not depend on GZIP - system may already have gzip
not for bbox.

> +#if ENABLE_FEATURE_GZIP_ROTATED_LOGFILE
> +                     // gzip if gzip enabled, create patch.
> +                     while (1) {
> +                             sprintf(newFile, "%s.%d.gz", log_file->path, i);
> +                             if (i == 0) break;
> +                             sprintf(oldFile, "%s.%d.gz", log_file->path, 
> --i);
> +                             /* ignore errors - file might be missing */
> +                             rename(oldFile, newFile);
> +                     }
> +                     /* newFile == "f.0" now */
> +                     sprintf(newFile, "%s.0", log_file->path);
> +                     rename(log_file->path, newFile);
> +                     char *argv[3] = {
> +                             "gzip",
> +                     };
> +                     argv[1] = newFile;
> +                     argv[2] = NULL;
> +                     spawn_and_wait(argv);
> +#else

It is unconditional? I assume an option would be better.

A more generic idea would be to run a user-defined helper
on the rotated logs.

Why do you need this feature at all?
-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to