[collectd] tail plugin counting problems

Matthias Lay mlay at telco-tech.de
Tue Oct 14 13:28:14 CEST 2008


Am Freitag, den 10.10.2008, 10:17 +0200 schrieb Florian Forster:
> Hi Matthias,

> So the problem appears to be that `fgets' doesn't check the file again.
> Could you please try if the following fix works for you?
> -- 8< --
> diff --git a/src/utils_tail.c b/src/utils_tail.c
> index eaf8f73..904a521 100644
> --- a/src/utils_tail.c
> +++ b/src/utils_tail.c
> @@ -162,6 +162,7 @@ int cu_tail_readline (cu_tail_t *obj, char *buf, int buflen)
>  
>    /* Try to read from the filehandle. If that succeeds, everything appears to
>     * be fine and we can return. */
> +  clearerr (obj->fh);
>    if (fgets (buf, buflen, obj->fh) != NULL)
>    {
>      buf[buflen - 1] = 0;
> -- 8< --
> 
Hi Octo,

with clearerr() the counter is growing without my truncating workaround. thanks for that!
I am testing your solution on my mail proxy right now.

I will check after some time if the counting gets the correct values and let you know

so far thx

loomy







More information about the collectd mailing list