im_tcp with InputType LineBased occasional truncated lines

View thread

sgcaveney (Last updated )

Hi folks,

We have an NXLog CE 3.2.2329 configuration using im_tcp with InputType LineBased, receiving blobs of JSON separated by newlines. The received data is passed to xm_perl and then relayed to an output.

Under some conditions where there may be thousands of events per second, there is a very rare chance for one event to be truncated at the end yielding an incomplete json blob.  We've verified that the input data coming from upstream is valid, fully formed JSON - the emitter encoding logs look OK. The preceeding and following lines are also received and parsed successfully. 

Has anybody else experienced similar behavior? At this point we suspect a bug in NXLog, considering that it occurs very infrequently (2-3 days between recurrences) and it only occurs during periods of relatively high load (normal load is ~150 events per second, load when issue occurs is ~800/s+)

Relevant configuration: 

<Extension gelf>

Module      xm_gelf

</Extension>

<Extension perl>

Module      xm_perl

PerlCode    /etc/nxlog/scripts/parse_mist.pl

</Extension>

<Input mist_tcp>

Module      im_tcp

Host        0.0.0.0

Port        32768

InputType   LineBased

<Exec>

perl_call("parse_mist");

if $nxlog_internal_drop_log drop();

</Exec>

</Input>

<Output graylog>

Module      om_udp

Host        x

Port        12201

OutputType  GELF

</Output>

<Route graylog>

Path       mist_tcp => graylog

</Route>