[syslog-ng] Writing line by line in Syslog-ng
Diluka Moratuwage
diluka at wso2.com
Tue Aug 14 10:47:23 CEST 2007
Hi Balazs,
Thanks for ur reply. With your help I could get it done. I used
fdopen and use,
fgets() and read line by line.
Thanks,
Diluka.
> I'm not sure I understand what you are trying to achieve here. You have
> to handle your incoming connection as a "stream" and perform appropriate
> input buffering.
>
> There's nothing that'd ensure that two blocks sent by syslog-ng will be
> received as two blocks by your program. This is not how TCP or
> SOCK_STREAM sockets work.
>
> Use an input buffer, read in a chunk of bytes and iterate over all
> complete lines in your input buffer. If there's only a partial line
> left, read again.
>
> The maximum line length will be limited by the size of your input
> buffer.
>
> You might be able to use stdio and its buffering if you want to avoid
> implementing input side buffering on your own.
>
> (e.g. fdopen() the socket fd and then use fgets() to read complete
> lines)
>
>
More information about the syslog-ng
mailing list