This is an automated email from the ASF dual-hosted git repository. joewitt pushed a commit to branch support/nifi-1.9.x in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 9874804846a02ae5d5e3291fe976cc0005af168a Author: Otto Fowler <[email protected]> AuthorDate: Sun Feb 24 20:40:48 2019 -0500 NIFI-6076 syslog5424 should support missing MSG - newer lib version and better test This closes #3331. Signed-off-by: Bryan Bende <[email protected]> --- .../nifi-extension-utils/nifi-syslog-utils/pom.xml | 2 +- .../syslog/BaseStrictSyslog5424ParserTest.java | 29 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-syslog-utils/pom.xml b/nifi-nar-bundles/nifi-extension-utils/nifi-syslog-utils/pom.xml index f8a0193..bb55b75 100644 --- a/nifi-nar-bundles/nifi-extension-utils/nifi-syslog-utils/pom.xml +++ b/nifi-nar-bundles/nifi-extension-utils/nifi-syslog-utils/pom.xml @@ -26,7 +26,7 @@ <dependency> <groupId>com.github.palindromicity</groupId> <artifactId>simple-syslog-5424</artifactId> - <version>0.0.8</version> + <version>0.0.11</version> </dependency> <dependency> <groupId>org.apache.nifi</groupId> diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-syslog-utils/src/test/java/org/apache/nifi/syslog/BaseStrictSyslog5424ParserTest.java b/nifi-nar-bundles/nifi-extension-utils/nifi-syslog-utils/src/test/java/org/apache/nifi/syslog/BaseStrictSyslog5424ParserTest.java index 082fbbd..6b19749 100644 --- a/nifi-nar-bundles/nifi-extension-utils/nifi-syslog-utils/src/test/java/org/apache/nifi/syslog/BaseStrictSyslog5424ParserTest.java +++ b/nifi-nar-bundles/nifi-extension-utils/nifi-syslog-utils/src/test/java/org/apache/nifi/syslog/BaseStrictSyslog5424ParserTest.java @@ -149,7 +149,7 @@ public abstract class BaseStrictSyslog5424ParserTest { public void testVariety() { final List<String> messages = new ArrayList<>(); - // supported examples from RFC 5424 + // supported examples from RFC 5424 including structured data with no message messages.add("<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - " + "ID47 - BOM'su root' failed for lonvick on /dev/pts/8"); messages.add("<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc " + @@ -171,6 +171,33 @@ public abstract class BaseStrictSyslog5424ParserTest { } @Test + public void testMessagePartNotRequired() { + final List<String> messages = new ArrayList<>(); + + 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\"]"); + + 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\"]"); + + for (final String message : messages) { + final byte[] bytes = message.getBytes(CHARSET); + final ByteBuffer buffer = ByteBuffer.allocate(bytes.length); + buffer.clear(); + buffer.put(bytes); + + final Syslog5424Event event = parser.parseEvent(buffer); + Assert.assertTrue(event.isValid()); + Assert.assertNull(event.getFieldMap().get(SyslogAttributes.SYSLOG_BODY)); + } + + + } + + @Test public void testInvalidPriority() { final String message = "10 Oct 13 14:14:43 localhost some body of the message";
