Skip to content

Commit

Permalink
Add links to format of syslog messages
Browse files Browse the repository at this point in the history
  • Loading branch information
g41797 committed Oct 19, 2023
1 parent a11fe8a commit 8334f1c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion internal/plugins/msgconsumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/asaskevich/EventBus"
"github.com/g41797/sputnik"
"github.com/g41797/sputnik/sidecar"
"github.com/g41797/syslogsidecar"
"github.com/g41797/syslogsidecar/e2e"
)

Expand Down Expand Up @@ -95,7 +96,7 @@ func ConvertConsumeMsg(inmsg map[string]string) sputnik.Msg {
smsg := sputnik.Msg{}
smsg["name"] = "consumed"
smsg["consumed"] = inmsg
smsg["data"] = ""
smsg[syslogsidecar.FormerMessage] = ""

return smsg
}
Expand Down
16 changes: 13 additions & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ func (s *Server) toMsg(logParts format.LogParts, msgLen int64) sputnik.Msg {
break
}

formerMsg, exists := logParts["data"].(string)
formerMsg, exists := logParts[FormerMessage].(string)
if exists {
result["data"] = formerMsg
result[FormerMessage] = formerMsg
}

parserError, exists := logParts[ParserError]
Expand Down Expand Up @@ -270,7 +270,16 @@ func toString(val any, typ string) string {
return result
}

//
// https://blog.datalust.co/seq-input-syslog/
//

// ------------------------------------
// priority = (facility * 8) + severity
// ------------------------------------

// RFC3164 parameters with type
// https://documentation.solarwinds.com/en/success_center/kss/content/kss_adminguide_syslog_protocol.htm
func RFC3164Props() map[string]string {
return map[string]string{
"priority": "int",
Expand All @@ -284,14 +293,15 @@ func RFC3164Props() map[string]string {
}

// RFC5424 parameters with type
// https://hackmd.io/@njjack/syslogformat
func RFC5424Props() map[string]string {
return map[string]string{
"priority": "int",
"facility": "int",
SeverityKey: "int",
"version": "int",
"timestamp": "time.Time",
"hostname": "string",
"version": "int",
"app_name": "string",
"proc_id": "string",
"msg_id": "string",
Expand Down

0 comments on commit 8334f1c

Please sign in to comment.