@@ -75,7 +75,7 @@ public sealed class LogMessageSyslog : LogMessage
7575 /// <summary>
7676 /// The <see cref="Regex"/> to parse a syslog <see cref="LogMessage"/>.
7777 /// </summary>
78- private static readonly Regex mSyslogLineRegex = new Regex ( @"<([0-9]{1,3})>" , RegexOptions . IgnoreCase ) ;
78+ private static readonly Regex mSyslogLineRegex = new Regex ( @"<([0-9]{1,3})>([\s]?[\d]+\s)?(.*) " , RegexOptions . IgnoreCase ) ;
7979
8080 #endregion
8181
@@ -243,11 +243,11 @@ private bool ParseData(string data, string timestampFormat)
243243
244244 uint priMatrix = uint . Parse ( msgMtc . Groups [ 1 ] . Value ) ;
245245
246- mSeverity = ( Severity ) ( ( int ) priMatrix & 0x07 ) ;
247- mFacility = ( Facility ) ( ( int ) priMatrix >> 3 ) ;
246+ mSeverity = ( Severity ) ( ( int ) priMatrix & 0x07 ) ;
247+ mFacility = ( Facility ) ( ( int ) priMatrix >> 3 ) ;
248248 mLocalTimestamp = DateTime . Now ;
249249
250- string syslogMessage = data . Substring ( msgMtc . Groups [ 0 ] . Length ) . TrimStart ( ) ;
250+ string syslogMessage = msgMtc . Groups [ 3 ] . Value . TrimStart ( ) ;
251251 int hostIndex = 0 ;
252252 bool dtParseResult = false ;
253253
@@ -277,14 +277,14 @@ private bool ParseData(string data, string timestampFormat)
277277 {
278278 mTimestamp = DateTime . Now ;
279279 }
280-
280+
281281 syslogMessage = syslogMessage . Substring ( hostIndex ) ;
282- mLogger = syslogMessage . Split ( ' ' ) [ 0 ] ;
283- mMessage = syslogMessage . Substring ( mLogger . Length + 1 ) ;
282+ mLogger = syslogMessage . TrimStart ( ) . Split ( ' ' ) [ 0 ] ;
283+ mMessage = syslogMessage . Substring ( mLogger . Length + 1 ) ;
284284
285285 return true ;
286286 }
287-
287+
288288 #endregion
289289
290290 #region Public Methods
@@ -360,17 +360,17 @@ public override Table ToLuaTable(Script owner)
360360 }
361361
362362 msgData [ "Facility" ] = LogFacility . ToString ( ) ;
363-
363+
364364 Table localTimeTable = new Table ( owner ) ;
365-
366- localTimeTable [ "Day" ] = Timestamp . Day ;
367- localTimeTable [ "Month" ] = Timestamp . Month ;
368- localTimeTable [ "Year" ] = Timestamp . Year ;
369- localTimeTable [ "Hour" ] = Timestamp . Hour ;
370- localTimeTable [ "Minute" ] = Timestamp . Minute ;
371- localTimeTable [ "Second" ] = Timestamp . Second ;
365+
366+ localTimeTable [ "Day" ] = Timestamp . Day ;
367+ localTimeTable [ "Month" ] = Timestamp . Month ;
368+ localTimeTable [ "Year" ] = Timestamp . Year ;
369+ localTimeTable [ "Hour" ] = Timestamp . Hour ;
370+ localTimeTable [ "Minute" ] = Timestamp . Minute ;
371+ localTimeTable [ "Second" ] = Timestamp . Second ;
372372 localTimeTable [ "Millisecond" ] = Timestamp . Millisecond ;
373- localTimeTable [ "Timestamp" ] = Timestamp . ToUnixTimestamp ( ) ;
373+ localTimeTable [ "Timestamp" ] = Timestamp . ToUnixTimestamp ( ) ;
374374
375375 msgData [ "LocalTimestamp" ] = localTimeTable ;
376376
0 commit comments