Re: logrotate script error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hey!


That worked!

/var/log/logstash/* {
        daily
        rotate 7
        copytruncate
        compress
        delaycompress
        missingok
        notifempty
        size 100M
        sharedscripts
        postrotate
        /bin/kill -HUP `cat /var/run/logstash.pid 2>/dev/null` 2> /dev/null
|| true
        endscript
}

Thanks for the help!

Tim

On Sat, Mar 5, 2016 at 11:15 PM, Yamaban <foerster@xxxxxxxx> wrote:

> On Sun, 6 Mar 2016 04:34, Tim Dunphy <bluethundr@...> wrote:
>
> Hey guys,
>>
>> I'm trying to rotate a logstash log that can grow pretty large. 3.4GB last
>> I saw!
>>
>> And that's because the logrotate script I came up with didn't work.
>>
>> The error I get on a syntax check is this:
>>
>> #logrotate -f logstash
>> size: '100M': No such file
>> size: '100M': No such file
>> size: '100M': No such file
>> size: '100M': No such file
>> size: '100M': No such file
>> size: '100M': No such file
>> size: '100M': No such file
>> size: '100M': No such file
>>
>> And this is the logstash rotate script:
>>
>> #cat /etc/logrotate.d/logstash
>> /var/log/logstash/* {
>>        daily
>>        rotate 7
>>        copytruncate
>>        compress
>>        delaycompress
>>        missingok
>>        notifempty
>>        postrotate
>>        size 100M
>>        /bin/kill -HUP `cat /var/run/logstash.pid 2>/dev/null` 2> /dev/null
>> || true
>>        endscript
>> }
>>
>> I can't find the error there. Can I have a suggestion as to what's wrong
>> and how to correct it?
>>
>
> Multiple errors here, first hint: "man 8 logrotate" is a good start.
>
> Second: wrong order of lines:
> diff -U2
> [code]
> --- your logstash-rotate
> +++ corrected logstash-rotate
> @@ -7,6 +7,7 @@
>         missingok
>         notifempty
> -       postrotate
>         size 100M
> +       sharedscripts
> +       postrotate
>         /bin/kill -HUP `cat /var/run/logstash.pid 2>/dev/null` 2>
> /dev/null || true
>         endscript
> [/code]
>
> In short: "postrotate" line is in wrong position, add line "sharedscripts"
>
>  - Yamaban.
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> https://lists.centos.org/mailman/listinfo/centos
>



-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux