mirror of
https://github.com/apache/nifi.git
synced 2025-03-06 17:39:36 +00:00
NIFI-6076 syslog5424 should support missing MSG
- newer lib version and better test This closes #3331. Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
parent
cd7edb1c04
commit
922da68a23
@ -26,7 +26,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.palindromicity</groupId>
|
<groupId>com.github.palindromicity</groupId>
|
||||||
<artifactId>simple-syslog-5424</artifactId>
|
<artifactId>simple-syslog-5424</artifactId>
|
||||||
<version>0.0.8</version>
|
<version>0.0.11</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.nifi</groupId>
|
<groupId>org.apache.nifi</groupId>
|
||||||
|
@ -149,7 +149,7 @@ public abstract class BaseStrictSyslog5424ParserTest {
|
|||||||
public void testVariety() {
|
public void testVariety() {
|
||||||
final List<String> messages = new ArrayList<>();
|
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 - " +
|
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");
|
"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 " +
|
messages.add("<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc " +
|
||||||
@ -170,6 +170,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
|
@Test
|
||||||
public void testInvalidPriority() {
|
public void testInvalidPriority() {
|
||||||
final String message = "10 Oct 13 14:14:43 localhost some body of the message";
|
final String message = "10 Oct 13 14:14:43 localhost some body of the message";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user