Hi again,
I have continued testing and still can't find where is the problem.
I have downloaded the plugin code from here:
logstash-input-tcp
and modified the logstash Gemfile to use it instead of the one included in logstash.
Then I have modified the channelRead method in the InputLoop.java file, adding logs for events:
@Override
public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
ByteBuf msgBB = (ByteBuf) msg;
String msgStr = msgBB.toString(Charset.forName("utf-8"));
logger.info("Event received: "+msgStr);
decoder.decode(ctx.channel().remoteAddress(), (ByteBuf) msg);
}
We are sending the csv data from a Python script with this format:
st = "%s,2,123069200000398,9999999%s,9999911111%s,,123,06,123,12345\n"%(current_milli_time(),counter,str(randint(1, 9999999999)))
Now, we can see in the log every event received:
[2022-02-10T15:55:32,592][INFO ][logstash.inputs.tcp ][tcp-in-stream][c43491a09699f02867d3c49411d208fc0e0309dc7eff9d341fe85064e8082ea5] Event received: 1644508532579,2,123069200000398,99999999785,99999111115769873442,,123,06,123,12345
[2022-02-10T15:55:32,607][INFO ][logstash.inputs.tcp ][tcp-in-stream][c43491a09699f02867d3c49411d208fc0e0309dc7eff9d341fe85064e8082ea5] Event received: 1644508532594,2,123069200000398,99999999786,99999111113222013386,,123,06,123,12345
[2022-02-10T15:55:44,188][INFO ][logstash.inputs.tcp ][tcp-in-stream][c43491a09699f02867d3c49411d208fc0e0309dc7eff9d341fe85064e8082ea5] Event received: 1644508544175,2,123069200000398,999999910375,99999111113615600681,,123,06,123,12345
[2022-02-10T15:55:44,236][INFO ][logstash.inputs.tcp ][tcp-in-stream][c43491a09699f02867d3c49411d208fc0e0309dc7eff9d341fe85064e8082ea5] Event received: 1644508544196,2,123069200000398,999999910376,99999111117577138132,,123,06,123,12345
And, from time to time, you can clearly see the error I commented on that the events are not being separated correctly:
[2022-02-10T15:55:32,582][INFO ][logstash.inputs.tcp ][tcp-in-stream][c43491a09699f02867d3c49411d208fc0e0309dc7eff9d341fe85064e8082ea5] Event received: ,2,123069200000398,99999999784,99999111112403560691,,123,06,123,12345
[2022-02-10T17:01:23,804][INFO ][logstash.inputs.tcp ][tcp-in-stream][c43491a09699f02867d3c49411d208fc0e0309dc7eff9d341fe85064e8082ea5] Event received: 3,06,123,12345
1644512475998,2,123069200000398,9999999217,99999111117496450496,,123,06,123,12345
1644512476013,2,123069200000398,9999999218,999991111171135868,,123,06,123,12345
1644512476029,2,123069200000398,9999999219,99999111111078786680,,123,06,123,12345
1644512476045,2,123069200000398,9999999220,99999111116152292516,,123,06,123,12345
1644512476061,2,123069200000398,9999999221,99999111113171709622,,123,06,123,
[2022-02-10T17:01:47,617][INFO ][logstash.inputs.tcp ][tcp-in-stream][c43491a09699f02867d3c49411d208fc0e0309dc7eff9d341fe85064e8082ea5] Event received: 45
[2022-02-10T17:02:59,478][INFO ][logstash.inputs.tcp ][tcp-in-stream][c43491a09699f02867d3c49411d208fc0e0309dc7eff9d341fe85064e8082ea5] Event received: ,2,123069200000398,99999996856,99999111114498294233,,123,06,123,12345
1644512579471,2,123069200000398,99999996857,99999111117355896946,,123,06,123,12345
[2022-02-10T17:03:47,309][INFO ][logstash.inputs.tcp ][tcp-in-stream][c43491a09699f02867d3c49411d208fc0e0309dc7eff9d341fe85064e8082ea5] Event received: ,2,123069200000398,99999999927,99999111116985331172,,123,06,123,12345