Skip to content

Commit ad41d30

Browse files
committed
chore: restructuring grammar for Cisco IOS case
Signed-off-by: Leonardo Di Donato <[email protected]>
1 parent c444817 commit ad41d30

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

rfc3164/machine.go.rl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,12 @@ sequence = (sequenceval ':' sp*) when { m.sequence };
177177
ciscoHostname = (hostname ':' sp*)? when { m.ciscoHostname };
178178
# and then they prepend a '*' to the timestamp if there is no NTP sync
179179
ciscostar = ('*'?) when { m.msgcount || m.sequence || m.ciscoHostname };
180-
ciscoextras = msgcount? <: sequence? <: ciscoHostname? ciscostar;
181180
# and they append a colon after the timestamp:
182181
# ...19:46:03.295: ...
183182
ciscocolon = (':'?) when { m.msgcount || m.sequence || m.ciscoHostname };
184183

184+
ciscoextras = msgcount? <: sequence? <: ciscoHostname?;
185+
185186
# Section 4.1.3
186187
# note > alnum{1,32} is too restrictive (eg., no dashes)
187188
# note > see https://tools.ietf.org/html/rfc2234#section-2.1 for an interpretation of "ABNF alphanumeric" as stated by RFC 3164 regarding the tag
@@ -204,7 +205,7 @@ fail := (any - [\n\r])* @err{ fgoto main; };
204205

205206
# note > some BSD syslog implementations insert extra spaces between "PRI", "Timestamp", and "Hostname": although these strictly violate RFC3164, it is useful to be able to parse them
206207
# note > OpenBSD like many other hardware sends syslog messages without hostname
207-
main := pri sp* ciscoextras (timestamp | (rfc3339 when { m.rfc3339 })) ciscocolon sp+ (hostname sp+)? msg '\n'?;
208+
main := pri sp* ciscoextras ciscostar (timestamp | (rfc3339 when { m.rfc3339 })) ciscocolon sp+ (hostname sp+)? msg '\n'?;
208209

209210
}%%
210211

0 commit comments

Comments
 (0)