Permalink
Browse files

another syslog fix

fixes #SERVER-287
  • Loading branch information...
lennartkoopmann committed Feb 6, 2013
1 parent 82d6e74 commit 438f8763ae230b5c1b4899058b006a5bb1b8cb5f
Showing with 25 additions and 3 deletions.
  1. +1 −1 install-syslog4j-jar.sh
  2. +1 −1 pom.xml
  3. +23 −1 src/test/java/org/graylog2/inputs/syslog/SyslogProcessorTest.java
View
@@ -1,2 +1,2 @@
echo "Installing our provided syslog4j fork .jar to local mvn repository for great justice!"
-mvn install:install-file -DgroupId=org.productivity.java -DartifactId=syslog4j-graylog2 -Dversion=0.9.47-graylog2 -Dpackaging=jar -Dfile=lib/syslog4j-graylog2-0.9.47-graylog2.jar
+mvn install:install-file -DgroupId=org.productivity.java -DartifactId=syslog4j-graylog2 -Dversion=0.9.48-graylog2 -Dpackaging=jar -Dfile=lib/syslog4j-graylog2-0.9.48-graylog2.jar
View
@@ -161,7 +161,7 @@
<dependency>
<groupId>org.productivity.java</groupId>
<artifactId>syslog4j-graylog2</artifactId>
- <version>0.9.47-graylog2</version>
+ <version>0.9.48-graylog2</version>
</dependency>
<dependency>
<groupId>com.github.stephenc.high-scale-lib</groupId>
@@ -30,12 +30,14 @@
public class SyslogProcessorTest {
- // http://tools.ietf.org/rfc/rfc5424.txt
public static String ValidStructuredMessage = "<165>1 2012-12-25T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"] BOMAn application event log entry";
public static String ValidStructuedMessageWithDifferentDateFormat = "<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc 8710 - - %% It's time to make the do-nuts";
public static String ValidNonStructuredMessage = "<86>Dec 24 17:05:01 foo-bar CRON[10049]: pam_unix(cron:session): session closed for user root";
public static String MessageLookingLikeStructured = "<133>NOMA101FW01A: NetScreen device_id=NOMA101FW01A [Root]system-notification-00257(traffic): start_time=\"2011-12-23 17:33:43\" duration=0 reason=Creation";
+ // http://jira.graylog2.org/browse/SERVER-287
+ public static String ValidNonStructuredMessageWithShortDate = "<38>Feb 5 10:18:12 foo-bar sshd[593115]: Accepted publickey for root from 94.XXX.XXX.XXX port 5992 ssh2";
+
@Test
public void testMessageReceivedWithNonStructuredMessage() throws Exception {
GraylogServerStub serverStub = new GraylogServerStub();
@@ -56,6 +58,26 @@ public void testMessageReceivedWithNonStructuredMessage() throws Exception {
assertEquals(ValidNonStructuredMessage, lm.getFullMessage());
assertEquals(0, lm.getAdditionalData().size());
}
+
+ @Test
+ public void testMessageReceivedWithNonStructuredMessageAndShortDate() throws Exception {
+ GraylogServerStub serverStub = new GraylogServerStub();
+ Configuration configStub = new Configuration();
+ serverStub.setConfigurationStub(configStub);
+ SyslogProcessor processor = new SyslogProcessor(serverStub);
+
+ processor.messageReceived(ValidNonStructuredMessageWithShortDate, InetAddress.getLocalHost());
+
+ LogMessage lm = serverStub.lastInsertedToProcessBuffer;
+
+ assertEquals(1, serverStub.callsToProcessBufferInserter);
+
+ assertEquals("security/authorization", lm.getFacility());
+ assertEquals("foo-bar", lm.getHost());
+ assertEquals(6, lm.getLevel());
+ assertEquals(ValidNonStructuredMessageWithShortDate, lm.getFullMessage());
+ assertEquals(0, lm.getAdditionalData().size());
+ }
@Test
public void testMessageReceivedWithStructuredMessage() throws Exception {

0 comments on commit 438f876

Please sign in to comment.