New syslog formatter for Golang (RFC 3164/5424/6587 compatible)

keyb1nd1 pts0 comments

GitHub - zveinn/go-syslog · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

zveinn

go-syslog

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>3 Commits<br>3 Commits

container_tests

container_tests

example

example

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

go.mod

go.mod

message.go

message.go

priority.go

priority.go

rfc3164.go

rfc3164.go

rfc5424.go

rfc5424.go

rfc6587.go

rfc6587.go

syslog_test.go

syslog_test.go

View all files

Repository files navigation

syslog

This is a package to format syslog messages based on standard RFCs.

Supported RFCs

RFC 3164 (BSD syslog)

RFC 5424 (modern syslog)

RFC 6587 (TCP framing, octet counting and non transparent)

Examples

Basic format:

b, err := syslog.FormatRFC5424(&syslog.Message{<br>Facility: syslog.FacUser,<br>Severity: syslog.SevInfo,<br>Hostname: "host",<br>AppName: "app",<br>Message: "hello",<br>})

Append into a reused buffer. After the buffer has grown to fit your largest message there are no further allocations:

buf := make([]byte, 0, 512)<br>for _, m := range messages {<br>buf = buf[:0]<br>buf, _ = syslog.AppendRFC5424(buf, m)<br>conn.Write(buf)

Wrap with RFC 6587 octet counting for TCP:

f := syslog.NewFrameRFC6587()<br>f.AddLog(msg1)<br>f.AddLog(msg2)<br>conn.Write(f.Bytes())

Performance

BenchmarkAppendRFC3164 74 ns/op 0 B/op 0 allocs/op<br>BenchmarkAppendRFC5424 285 ns/op 0 B/op 0 allocs/op<br>BenchmarkFormatRFC3164 108 ns/op 112 B/op 1 allocs/op<br>BenchmarkFrameRFC6587_AddLog 9 ns/op 0 B/op 0 allocs/op<br>BenchmarkFrameRFC6587NonTransparent_AddLog 8 ns/op 0 B/op 0 allocs/op

About

No description, website, or topics provided.

Resources

Readme

License

MIT license

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

star

Watchers

watching

Forks

fork

Report repository

Releases

tags

Packages

Uh oh!

There was an error while loading. Please reload this page.

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

Go<br>92.6%

Shell<br>7.4%

You can’t perform that action at this time.

syslog reload message search allocs license

Related Articles