NIFI-6443 - ParseSyslog5424 n-th SD-ELEMENT isn't parsed

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #3588.
This commit is contained in:
mike 2019-07-18 14:29:41 +10:00 committed by Pierre Villard
parent f2db1539a8
commit 3fb4454375
No known key found for this signature in database
GPG Key ID: BEE1599F0726E9CD
7 changed files with 13 additions and 12 deletions

View File

@ -26,7 +26,7 @@
<dependency>
<groupId>com.github.palindromicity</groupId>
<artifactId>simple-syslog-5424</artifactId>
<version>0.0.11</version>
<version>0.0.13</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>

View File

@ -157,7 +157,7 @@ public abstract class BaseStrictSyslog5424ParserTest {
messages.add("<14>1 2014-06-20T09:14:07+00:00 loggregator"
+ " d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01"
+ " [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"]"
+ " [exampleSDID@32480 iut=\"4\" eventSource=\"Other Application\" eventID=\"2022\"] Removing instance");
+ "[exampleSDID@32480 iut=\"4\" eventSource=\"Other Application\" eventID=\"2022\"] Removing instance");
for (final String message : messages) {
final byte[] bytes = message.getBytes(CHARSET);
@ -181,7 +181,7 @@ public abstract class BaseStrictSyslog5424ParserTest {
messages.add("<14>1 2014-06-20T09:14:07+00:00 loggregator"
+ " d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01"
+ " [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"]"
+ " [exampleSDID@32480 iut=\"4\" eventSource=\"Other Application\" eventID=\"2022\"]");
+ "[exampleSDID@32480 iut=\"4\" eventSource=\"Other Application\" eventID=\"2022\"]");
for (final String message : messages) {
final byte[] bytes = message.getBytes(CHARSET);
@ -191,7 +191,7 @@ public abstract class BaseStrictSyslog5424ParserTest {
final Syslog5424Event event = parser.parseEvent(buffer);
Assert.assertTrue(event.isValid());
Assert.assertNull(event.getFieldMap().get(SyslogAttributes.SYSLOG_BODY));
Assert.assertNull(event.getFieldMap().get(SyslogAttributes.SYSLOG_BODY.key()));
}
@ -218,7 +218,7 @@ public abstract class BaseStrictSyslog5424ParserTest {
final String message = "<14>1 2014-06-20T09:14:07+00:00 loggregator"
+ " d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01"
+ " [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"]"
+ " [exampleSDID@32480 iut=\"4\" eventSource=\"Other Application\" eventID=\"2022\"] Removing instance";
+ "[exampleSDID@32480 iut=\"4\" eventSource=\"Other Application\" eventID=\"2022\"] Removing instance";
final byte[] bytes = message.getBytes(CHARSET);
final ByteBuffer buffer = ByteBuffer.allocate(bytes.length);
@ -229,5 +229,6 @@ public abstract class BaseStrictSyslog5424ParserTest {
Assert.assertNotNull(event);
Assert.assertTrue(event.isValid());
Assert.assertEquals(sender, event.getSender());
Assert.assertEquals("Removing instance", event.getFieldMap().get(SyslogAttributes.SYSLOG_BODY.key()));
}
}

View File

@ -59,7 +59,7 @@ public class TestSyslogRecordReader {
private static final String expectedMessage = expectedAppName +
" " + expectedProcId +
" " + expectedMessageId +
" " + "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"] [exampleSDID@32480 iut=\"4\" eventSource=\"Other Application\" eventID=\"2022\"]" +
" " + "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][exampleSDID@32480 iut=\"4\" eventSource=\"Other Application\" eventID=\"2022\"]" +
" " + "Removing instance";
private static final String expectedPri = "14";
private static final String expectedTimestamp = "2014-06-20T09:14:07+00:00";

View File

@ -1 +1 @@
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA - [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] [exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA - [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance

View File

@ -1 +1 @@
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] [exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance

View File

@ -1,3 +1,3 @@
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA - - Removing instance
<14>1 2014-06-20T09:14:07Z loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] [exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] [exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance
<14>1 2014-06-20T09:14:07Z loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance

View File

@ -1,4 +1,4 @@
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA - - Removing instance
POISONPILL 30303030
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] [exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] [exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance
<14>1 2014-06-20T09:14:07+00:00 loggregator d0602076-b14a-4c55-852a-981e7afeed38 DEA MSG-01 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][exampleSDID@32480 iut="4" eventSource="Other Application" eventID="2022"] Removing instance