Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updating tests since 5424 messages send type

  • Loading branch information...
commit 657c8e7f36153313a17070fefd79c15d3a4dea2e 1 parent 1526437
Squeeks authored

Showing 1 changed file with 16 additions and 5 deletions. Show diff stats Hide diff stats

  1. +16 5 test/parse_5424.js
21 test/parse_5424.js
@@ -2,7 +2,6 @@ var syslogParser = require('../lib/glossy/parse.js'),
2 2 assert = require('assert');
3 3
4 4 assert.ok(syslogParser, 'parser loaded');
5   -
6 5 var withPrecisionTime = "<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc 8710 - - %% It's time to make the do-nuts.";
7 6 syslogParser.parse(withPrecisionTime, function(parsedMessage){
8 7 var expectedData = {
@@ -12,6 +11,7 @@ syslogParser.parse(withPrecisionTime, function(parsedMessage){
12 11 severityID: 5,
13 12 facility: 'local4',
14 13 severity: 'notice',
  14 + type: 'RFC5424',
15 15 host: '192.0.2.1',
16 16 appName: 'myproc',
17 17 pid: '8710',
@@ -20,6 +20,7 @@ syslogParser.parse(withPrecisionTime, function(parsedMessage){
20 20
21 21 delete parsedMessage.time;
22 22 assert.deepEqual(parsedMessage, expectedData);
  23 +
23 24 });
24 25
25 26 // FIXME 3 minute offset from UTC?!
@@ -32,6 +33,7 @@ syslogParser.parse(with8601, function(parsedMessage){
32 33 severityID: 2,
33 34 facility: 'auth',
34 35 severity: 'crit',
  36 + type: 'RFC5424',
35 37 time: new Date('2003-10-11T22:14:15.003Z'),
36 38 host: 'mymachine.example.com',
37 39 appName: 'su',
@@ -52,23 +54,31 @@ syslogParser.parse(withSD, function(parsedMessage){
52 54 severityID: 5,
53 55 facility: 'local4',
54 56 severity: 'notice',
  57 + type: 'RFC5424',
55 58 time: new Date('2003-10-11T22:14:15.003Z'),
56 59 host: 'mymachine.example.com',
57 60 appName: 'evntslog',
58 61 pid: null,
59 62 msgID: 'ID47',
60   - structuredData: { 'exampleSDID@32473': { iut: '3', eventID: '1011' } }, //FIXME " shouldn't be there
  63 + structuredData: {
  64 + 'exampleSDID@32473': {
  65 + iut: '3',
  66 + eventSource: 'Application',
  67 + eventID: '1011'
  68 + }
  69 + },
61 70 message: 'BOMAn application event log entry...' };
62 71
63   - // assert.deepEqual(parsedMessage, expectedData);
  72 + assert.deepEqual(parsedMessage, expectedData);
64 73 });
65 74
66 75 // FIXME 3 minute offset from UTC?!
67   -var withDoubleSD = '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][examplePriority@32473 class="high"] ';
  76 +var withDoubleSD = '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][examplePriority@32473 class="high"]';
68 77 syslogParser.parse(withSD, function(parsedMessage){
69 78 var expectedStructuredData = {
70 79 'exampleSDID@32473': {
71   - iut: '3',
  80 + iut: '3',
  81 + eventSource: 'Application',
72 82 eventID: '1011'
73 83 },
74 84 'examplePriority@32473': {
@@ -83,6 +93,7 @@ syslogParser.parse(withSD, function(parsedMessage){
83 93 severityID: 5,
84 94 facility: 'local4',
85 95 severity: 'notice',
  96 + type: 'RFC5424',
86 97 time: new Date('2003-10-11T22:14:15.003Z'),
87 98 host: 'mymachine.example.com',
88 99 appName: 'evntslog',

0 comments on commit 657c8e7

Please sign in to comment.
Something went wrong with that request. Please try again.