Skip to content

Commit

Permalink
Merge pull request #5103 from rgerhards/i5078
Browse files Browse the repository at this point in the history
imptcp bugfix: spam log on oversize message
  • Loading branch information
rgerhards committed Apr 17, 2023
2 parents 85fd928 + d9223cd commit d26f0af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions plugins/imptcp/imptcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ processDataRcvd(ptcpsess_t *const __restrict__ pThis,
"max msg size; message will be split starting at: \"%.*s\"\n",
pThis->pLstn->pSrv->pszInputName, i, (i < 32) ? i : 32, *buff);
doSubmitMsg(pThis, stTime, ttGenTime, pMultiSub);
iMsg = 0;
++(*pnMsgs);
if(pThis->pLstn->pSrv->discardTruncatedMsg == 1) {
pThis->inputState = eInMsgTruncation;
Expand Down
15 changes: 11 additions & 4 deletions tests/imptcp-oversize-message-display.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,27 @@ tcpflood -m1 -M "\"<120> 2011-03-01T11:22:12Z host tag: this is a way too long m
shutdown_when_empty
wait_shutdown

grep "imptcp: message received.*150 byte larger.*will be split.*\"ghijkl" $RSYSLOG_OUT_LOG > /dev/null
if [ $? -ne 0 ]; then
if ! grep "imptcp: message received.*150 byte larger.*will be split.*\"ghijkl" $RSYSLOG_OUT_LOG > /dev/null
then
echo
echo "FAIL: expected error message from imptcp truncation not found. $RSYSLOG_OUT_LOG is:"
cat $RSYSLOG_OUT_LOG
error_exit 1
fi

grep "imptcp: message received.*22 byte larger.*will be split.*\"sstets" $RSYSLOG_OUT_LOG > /dev/null
if [ $? -ne 0 ]; then
if ! grep "imptcp: message received.*22 byte larger.*will be split.*\"sstets" $RSYSLOG_OUT_LOG > /dev/null
then
echo
echo "FAIL: expected error message from imptcp truncation not found. $RSYSLOG_OUT_LOG is:"
cat $RSYSLOG_OUT_LOG
error_exit 1
fi
if grep "imptcp: message received.*21 byte larger" $RSYSLOG_OUT_LOG > /dev/null
then
echo
echo "FAIL: UNEXPECTED error message from imptcp truncation found. $RSYSLOG_OUT_LOG is:"
cat $RSYSLOG_OUT_LOG
error_exit 1
fi

exit_test

0 comments on commit d26f0af

Please sign in to comment.