Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format of syslog is not RFC Compliant #236

Open
jjfallete opened this issue Jan 26, 2024 · 0 comments
Open

Format of syslog is not RFC Compliant #236

jjfallete opened this issue Jan 26, 2024 · 0 comments

Comments

@jjfallete
Copy link

Is your feature request related to a problem? Please describe.

Currently, the cb-event-forwarder does not use RFC compliant syslog format (RFC 3164 or RFC 5424). As a result, syslog servers do not properly parse the hostname identifier without manual intervention, some fall back to using the sending IP address to identify the source.



Here is an example of an event sent from the cb-event-forwarder:

<6> 2024-01-25T12:00:00-04:00 CBSERVER /usr/share/cb/integrations/event-forwarder/cb-event-forwarder[10000]: LEEF:1.0|CB|CB|5.1|ingress.event.process|cb_server=CBSERVER    command_line=...




If this was RFC format compliant, we'd see either:

//RFC 3164 
<6>1 2024-01-25T12:00:00-04:00 CBSERVER /usr/share/cb/integrations/event-forwarder/cb-event-forwarder 10000 LEEF:1.0|CB|CB|5.1|ingress.event.process|cb_server=CBSERVER    command_line=...
//RFC 5424
<6>Jan 25 12:00:00 CBSERVER LEEF:1.0|CB|CB|5.1|ingress.event.process|cb_server=CBSERVER    command_line=...

Describe the solution you'd like

Update the cb-event-forwarder to be RFC compliant. RFC 3164 may be more desirable as it is most similar to the existing format and is more detailed.

After reviewing the codebase, I believe only a small change is needed to do this...

After this line:

o.outputSocket, err = syslog.DialWithTLSConfig(o.protocol, o.hostnamePort, syslog.LOG_INFO, o.tag, o.Config.TLSConfig)

Add:

// Reference from the syslog import source: github.com/RackSec/srslog/blob/master/formatter.go#L35
o.outputSocket.SetFormatter(syslog.RFC3164Formatter)  // Alternatively: RFC5424Formatter

Describe alternatives you've considered

N/A

Additional context

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant