GithubHelp home page GithubHelp logo

influxdata / go-syslog Goto Github PK

View Code? Open in Web Editor NEW
477.0 19.0 68.0 796 KB

Blazing fast syslog parser

License: MIT License

Makefile 0.86% Go 94.44% Ragel 4.70%
syslog parser ragel rfc5424 rfc5425 logging builder logs rfc6587 rfc5426

go-syslog's Introduction

Important

go-syslog is maintained by the original author at leodido/go-syslog

This repository is maintained only as a placeholder; it is not actively developed and may be out of date.

MIT License

A parser for Syslog messages and transports.

Blazing fast Syslog parsers

By @leodido.

To wrap up, this package provides:

This library provides the pieces to parse Syslog messages transported following various RFCs.

For example:

  • TLS with octet count (RFC5425)
  • TCP with non-transparent framing or with octet count (RFC 6587)
  • UDP carrying one message per packet (RFC5426)

Installation

go get github.com/influxdata/go-syslog/v3

Docs

Documentation

The docs directory contains .dot files representing the finite-state machines (FSMs) implementing the syslog parsers and transports.

Usage

Suppose you want to parse a given sequence of bytes as a RFC5424 message.

Notice that the same interface applies for RFC3164. But you can always take a look at the examples file.

i := []byte(`<165>4 2018-10-11T22:14:15.003Z mymach.it e - 1 [ex@32473 iut="3"] An application event log entry...`)
p := rfc5424.NewParser()
m, e := p.Parse(i)

This results in m being equal to:

// (*rfc5424.SyslogMessage)({
//  Base: (syslog.Base) {
//   Facility: (*uint8)(20),
//   Severity: (*uint8)(5),
//   Priority: (*uint8)(165),
//   Timestamp: (*time.Time)(2018-10-11 22:14:15.003 +0000 UTC),
//   Hostname: (*string)((len=9) "mymach.it"),
//   Appname: (*string)((len=1) "e"),
//   ProcID: (*string)(<nil>),
//   MsgID: (*string)((len=1) "1"),
//   Message: (*string)((len=33) "An application event log entry...")
//  },
//  Version: (uint16) 4,
//  StructuredData: (*map[string]map[string]string)((len=1) {
//   (string) (len=8) "ex@32473": (map[string]string) (len=1) {
//    (string) (len=3) "iut": (string) (len=1) "3"
//   }
//  })
// })

And e being equal to nil since the i byte slice contains a perfectly valid RFC5424 message.

Best effort mode

RFC5424 parser has the ability to perform partial matches (until it can).

With this mode enabled, when the parsing process errors out it returns the message collected until that position, and the error that caused the parser to stop.

Notice that in this modality the output is returned iff it represents a minimally valid message - ie., a message containing almost a priority field in [1,191] within angular brackets, followed by a version in ]0,999] (in the case of RFC5424).

Let's look at an example.

i := []byte("<1>1 A - - - - - -")
p := NewParser(WithBestEffort())
m, e := p.Parse(i)

This results in m being equal to the following SyslogMessage instance.

// (*rfc5424.SyslogMessage)({
//  Base: (syslog.Base) {
//   Facility: (*uint8)(0),
//   Severity: (*uint8)(1),
//   Priority: (*uint8)(1),
//   Timestamp: (*time.Time)(<nil>),
//   Hostname: (*string)(<nil>),
//   Appname: (*string)(<nil>),
//   ProcID: (*string)(<nil>),
//   MsgID: (*string)(<nil>),
//   Message: (*string)(<nil>)
//  },
//  Version: (uint16) 1,
//  StructuredData: (*map[string]map[string]string)(<nil>)
// })

And, at the same time, in e reporting the error that actually stopped the parser.

// expecting a RFC3339MICRO timestamp or a nil value [col 5]

Both m and e have a value since at the column the parser stopped it already was able to construct a minimally valid RFC5424 SyslogMessage.

Builder

This library also provides a builder to construct valid syslog messages.

Notice that its API ignores input values that does not match the grammar.

Let's have a look to an example.

msg := &rfc5424.SyslogMessage{}
msg.SetTimestamp("not a RFC3339MICRO timestamp")
msg.Valid() // Not yet a valid message (try msg.Valid())
msg.SetPriority(191)
msg.SetVersion(1)
msg.Valid() // Now it is minimally valid

Printing msg you will verify it contains a nil timestamp (since an invalid one has been given).

// (*rfc5424.SyslogMessage)({
//  Base: (syslog.Base) {
//   Facility: (*uint8)(23),
//   Severity: (*uint8)(7),
//   Priority: (*uint8)(191),
//   Timestamp: (*time.Time)(<nil>),
//   Hostname: (*string)(<nil>),
//   Appname: (*string)(<nil>),
//   ProcID: (*string)(<nil>),
//   MsgID: (*string)(<nil>),
//   Message: (*string)(<nil>)
//  },
//  Version: (uint16) 1,
//  StructuredData: (*map[string]map[string]string)(<nil>)
// })

Finally you can serialize the message into a string.

str, _ := msg.String()
// <191>1 - - - - - -

Message transfer

Excluding encapsulating one message for packet in packet protocols there are two ways to transfer syslog messages over streams.

The older - ie., the non-transparent framing - and the newer one - ie., the octet counting framing - which is reliable and has not been seen to cause problems noted with the non-transparent one.

This library provide stream parsers for both.

Octet counting

In short, RFC5425 and RFC6587, aside from the protocol considerations, describe a transparent framing technique for Syslog messages that uses the octect counting technique - ie., the message length of the incoming message.

Each Syslog message is sent with a prefix representing the number of bytes it is made of.

The octecounting package parses messages stream following such rule.

To quickly understand how to use it please have a look at the example file.

Non transparent

The RFC6587 also describes the non-transparent framing transport of syslog messages.

In such case the messages are separated by a trailer, usually a line feed.

The nontransparent package parses message stream following such technique.

To quickly understand how to use it please have a look at the example file.

Things we do not support:

  • trailers other than LF or NUL
  • trailers which length is greater than 1 byte
  • trailer change on a frame-by-frame basis

Performances

To run the benchmark execute the following command.

make bench

On my machine1 these are the results obtained paring RFC5424 syslog messages with best effort mode on.

[no]_empty_input__________________________________  4524100        274 ns/op      272 B/op        4 allocs/op
[no]_multiple_syslog_messages_on_multiple_lines___  3039513        361 ns/op      288 B/op        8 allocs/op
[no]_impossible_timestamp_________________________  1244562        951 ns/op      512 B/op       11 allocs/op
[no]_malformed_structured_data____________________  2389249        512 ns/op      512 B/op        9 allocs/op
[no]_with_duplicated_structured_data_id___________  1000000       1183 ns/op      712 B/op       17 allocs/op
[ok]_minimal______________________________________  6876235        178 ns/op      227 B/op        5 allocs/op
[ok]_average_message______________________________   730473       1653 ns/op     1520 B/op       24 allocs/op
[ok]_complicated_message__________________________   908776       1344 ns/op     1264 B/op       24 allocs/op
[ok]_very_long_message____________________________   392737       3114 ns/op     2448 B/op       25 allocs/op
[ok]_all_max_length_and_complete__________________   510740       2431 ns/op     1872 B/op       28 allocs/op
[ok]_all_max_length_except_structured_data_and_mes   755124       1593 ns/op      867 B/op       13 allocs/op
[ok]_minimal_with_message_containing_newline______  6142984        199 ns/op      230 B/op        6 allocs/op
[ok]_w/o_procid,_w/o_structured_data,_with_message  1670286        732 ns/op      348 B/op       10 allocs/op
[ok]_minimal_with_UTF-8_message___________________  3013480        407 ns/op      339 B/op        6 allocs/op
[ok]_minimal_with_UTF-8_message_starting_with_BOM_  2926410        423 ns/op      355 B/op        6 allocs/op
[ok]_with_structured_data_id,_w/o_structured_data_  1558971        814 ns/op      570 B/op       11 allocs/op
[ok]_with_multiple_structured_data________________  1000000       1243 ns/op     1205 B/op       16 allocs/op
[ok]_with_escaped_backslash_within_structured_data  1000000       1025 ns/op      896 B/op       17 allocs/op
[ok]_with_UTF-8_structured_data_param_value,_with_  1000000       1241 ns/op     1034 B/op       19 allocs/op

As you can see it takes:

  • ~250ns to parse the smallest legal message

  • less than 2µs to parse an average legal message

  • ~3µs to parse a very long legal message

Other RFC5424 implementations, like this one in Rust, spend 8µs to parse an average legal message.

TBD: comparison against other Go parsers.


  • [1]: Intel Core i7-8850H CPU @ 2.60GHz

go-syslog's People

Contributors

andig avatar bastjan avatar dependabot[bot] avatar fntlnz avatar goller avatar leodido avatar lxfontes avatar ob avatar tkyocum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-syslog's Issues

another library's benchmark

I tried out your benchmarks with my library.

Some notes:

  • Didn't originally support multiple sd elements, so that was added for these benchmarks. Wish the RFC read better on this.
  • Don't support all the error messages you have here. An error is returned for malformed syslog format, but not what caused the error.
  • No validation is done on the uniqueness of sd id. I'm using a different data structure as sd elements can have the key defined multiple times.
  • Don't use pointers. Just the string conversion from the []byte.

RFC3164: parsing syslog without PRI part

When syslog is being saved to files, the PRI value is typically removed (I don't know real reason for that though, but it's just my observation). And go-syslog complains that it can't find a PRI value when parsing syslog files. I worked it around by prepending every line with some dummy priority before parsing, but could we add at least an option to support syslog messages without a PRI value?

Also, as of now the Parse method just takes a byte array, there is no option to parse from an io.Reader; it makes prepending messages expensive. Can we make it possible to parse from an io.Reader as well? (It probably warrants for a separate issue, but it's more of a related question for now, so leaving it here)

Thanks!

Setup CI

Decide whether to use the internal CI/CD for this or stick with circle/travis.


cc @fntlnz

Unable to use rfc3164 (BSD syslog) parser in combination with nontransparent or octet-counted parsers

I'm trying to parse messages from rsyslog's owfwd module. rsyslog uses BSD syslog messages (RFC 3164). However, the two parsers that can handle reading multiple syslog messages from a stream, nontransparent and octetcounting, both assume RFC 5424 style syslog messages.

Is it possible to add parsing multiple BSD-style syslog messages (with both framing methods) as well?

rsyslog documentation: https://www.rsyslog.com/doc/v8-stable/configuration/modules/omfwd.html#tcp-framing

RFC 3164

Hi,

Any idea when that feature branch could be merged?

Thanks!

Git lfs is over quota

dep ensure -add github.com/influxdata/go-syslog results in

Error downloading object: docs/rfc5424_appname.png (81860ca): Smudge error: Error downloading docs/rfc5424_appname.png (81860caa2b2707b7f5eb5d4cd1f1c29593b2af4c5ae99f042a761c4e356ff9d9): batch response: This repository is over its data quota. Purchase more data packs to restore access.

Log parser in another format

Hello,

We are trying to use go-syslog parser to parse syslogs for one of our system but our logs are in format as below:

Oct 11 22:14:15 su: 'su root' failed for lonvick on /dev/pts/8

So is there any way/standard to parse the logs in this format?

as we have checked the go-syslog supports logs in format of

<152> Oct 11 22:14:15 su: 'su root' failed for lonvick on /dev/pts/8

Any help on this will be appreciated.

Syslog message without PRI header

Hi,

I'm using the OTEL syslog receiver that's using go-syslog.
While doing testing I noticed that the PRI header is mandatory. after some local debugging, I found this code

if (m.data)[(m.p)] == 60 {
			goto st2
		}

since multiple products sending their syslog message without the PRI header, this is blocking us.
I added a new 'MachineOption' locally to support 'no PRI' messages and tested it.

I would be more than happy to open a PR and merge it.

thanks

Unclear how to get actual data out of the Message interface

Hi. I'm trying to use this library to parse messages that rsyslog sends over a TCP connection. All examples in the repository do a "dump" of the syslog.Result type, which shows the data that is contained within the concrete types, but there is no example that shows how to get (for instance) the message payload out of the syslog.Message interface.

I assume you need to typecast Result.Message into its concrete type to access the actual data, but this is not explained or shown anywhere in the documentation. Could this be clarified?

RFC5424: error on non UTF-8 free-form message

Hi,
There's seems to be a problem with parsing of RFC5424 messages, that contain non-UTF8 bytes/sequences in free-form message field (MSG). Parser returns following error:

expecting a free-form optional message in UTF-8 (starting with or without BOM)

But according to RFC5424 this field may contain data in any encoding.
Could you please make parser more relaxed about that issue?

Thanks!

go.mod should have /v2 at the end of the module name

This is a follow-up of #19 which still appears broken. Consider this:

❯ go mod init foo
go: creating new go.mod: module foo

❯ go get github.com/influxdata/go-syslog@latest && cat go.mod 
module foo

go 1.13

require github.com/influxdata/go-syslog v1.0.1 // indirect

❯ go get github.com/influxdata/[email protected]
go: finding github.com/influxdata/go-syslog v2.0.0
go get github.com/influxdata/[email protected]: github.com/influxdata/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2

go get will never install a v2 version as the import path does not match. See https://github.com/golang/go/wiki/Modules#semantic-import-versioning for path names.

My feeling is that as this stage the right thing would be to release a 3.0 version (branched from 2.0) with a /v3 import path.

Can rfc3164 (BSD syslog) parser support custom timestamp format?

rfc3164 parser can parse log like logStr = "<134>Jul 16 02:15:13 an 200050021 id=OS time="2020-7-16 02:15:13" timezone=GMT(+0000)", but can't parse log like
logStr = "<134>Jul 16 2020 02:15:13 an 200050021 id=OS time="2020-7-16 02:15:13" timezone=GMT(+0000)". It will cause error: expecting a Stamp timestamp [col 14].

RFC3164: square brackets in the message screw parsing of ProcID

Parser created as follows:

		p := rfc3164.NewParser(
			rfc3164.WithYear(rfc3164.Year{YYYY: 2020}),
			rfc3164.WithRFC3339(),
		)

Example input:

<0>Mar  1 09:38:48 myhost myapp[12345]: foo [bar] baz

Output (take a look at ProcID):

{
  "Facility": 0,
  "Severity": 0,
  "Priority": 0,
  "Timestamp": "2020-03-01T09:38:48Z",
  "Hostname": "myhost",
  "Appname": "myapp",
  "ProcID": "foo [bar",
  "MsgID": null,
  "Message": "foo [bar] baz"
}

我通过此类去解析 UDP 协议的内容,但无法生效。

Code

package main

import (
	"fmt"
	"github.com/davecgh/go-spew/spew"
	"github.com/influxdata/go-syslog/v3/rfc3164"
	"log"
	"net"
)

func main() {
	p := rfc3164.NewParser()
	p.WithBestEffort()
	msg, _ := p.Parse([]byte("<14>Dec 21 09:08:10 Flcs-MacBook-Pro.local tw8591_financial_fas_laravel[17753]: [2022-12-21 17:08:10] dev.INFO: aasdfasdf=====0  \\n"))

	spew.Config.DisableCapacities = true
	spew.Config.DisablePointerAddresses = true
	spew.Dump(msg)
	spew.Dump(msg.(*rfc3164.SyslogMessage).Message)
	// return

	// 创建一个 PacketConn 接口
	conn, err := net.ListenPacket("udp", ":12190")
	if err != nil {
		log.Fatal(err)
		return
	}
	defer conn.Close()

	// 接收数据
	buf := make([]byte, 1024)
	for {
		n, addr, err := conn.ReadFrom(buf)
		if err != nil {
			fmt.Println(err)
			continue
		}

		spew.Dump(buf)
		spew.Dump(string(buf[:n]))
		spew.Dump(msg, err)
		spew.Dump(addr)
		spew.Dump(n)

		// 解析数据
		msg, err := p.Parse([]byte(fmt.Sprintf("%s", buf[:n])))
		switch msg.(type) {
		case *rfc3164.SyslogMessage:
			spew.Dump(fmt.Sprintln("123123"))
			spew.Dump(msg.(*rfc3164.SyslogMessage))
		}
	}
}

Out

(*rfc3164.SyslogMessage)({
 Base: (syslog.Base) {
  Facility: (*uint8)(1),
  Severity: (*uint8)(6),
  Priority: (*uint8)(14),
  Timestamp: (*time.Time)(0000-12-21 09:08:10 +0000 UTC),
  Hostname: (*string)((len=22) "Flcs-MacBook-Pro.local"),
  Appname: (*string)((len=1) "f"),
  ProcID: (*string)((len=20) "[2022-12-21 17:08:10"),
  MsgID: (*string)(<nil>),
  Message: (*string)((len=51) "[2022-12-21 17:08:10] dev.INFO: aasdfasdf=====0  \\n")
 }
})
(*string)((len=51) "[2022-12-21 17:08:10] dev.INFO: aasdfasdf=====0  \\n")
([]uint8) (len=1024) {
 00000000  3c 31 34 3e 44 65 63 20  32 31 20 31 30 3a 33 35  |<14>Dec 21 10:35|
 00000010  3a 30 30 20 46 6c 63 73  2d 4d 61 63 42 6f 6f 6b  |:00 Flcs-MacBook|
 00000020  2d 50 72 6f 2e 6c 6f 63  61 6c 20 66 5b 32 31 31  |-Pro.local f[211|
 00000030  39 32 5d 3a 20 5b 32 30  32 32 2d 31 32 2d 32 31  |92]: [2022-12-21|
 00000040  20 31 38 3a 33 35 3a 30  30 5d 20 64 65 76 2e 49  | 18:35:00] dev.I|
 00000050  4e 46 4f 3a 20 61 61 73  64 66 61 73 64 66 3d 3d  |NFO: aasdfasdf==|
 00000060  3d 3d 3d 30 20 20 0a 00  00 00 00 00 00 00 00 00  |===0  ..........|
 00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000080  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000000b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000000c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000000d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000000e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000100  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000120  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000130  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000140  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000150  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000160  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000170  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000180  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000190  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000230  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000240  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000250  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000270  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000280  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000290  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000002a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000002b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000002c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000002d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000002e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000002f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000300  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000310  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000320  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000330  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000340  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000350  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000360  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000370  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000380  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 00000390  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000003a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000003b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000003c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000003d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000003e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 000003f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
}
(string) (len=103) "<14>Dec 21 10:35:00 Flcs-MacBook-Pro.local f[21192]: [2022-12-21 18:35:00] dev.INFO: aasdfasdf=====0  \n"
(*rfc3164.SyslogMessage)({
 Base: (syslog.Base) {
  Facility: (*uint8)(1),
  Severity: (*uint8)(6),
  Priority: (*uint8)(14),
  Timestamp: (*time.Time)(0000-12-21 09:08:10 +0000 UTC),
  Hostname: (*string)((len=22) "Flcs-MacBook-Pro.local"),
  Appname: (*string)((len=1) "f"),
  ProcID: (*string)((len=20) "[2022-12-21 17:08:10"),
  MsgID: (*string)(<nil>),
  Message: (*string)((len=51) "[2022-12-21 17:08:10] dev.INFO: aasdfasdf=====0  \\n")
 }
})
(interface {}) <nil>
(*net.UDPAddr)(127.0.0.1:52055)
(int) 103
(string) (len=7) "123123\n"
(*rfc3164.SyslogMessage)({
 Base: (syslog.Base) {
  Facility: (*uint8)(1),
  Severity: (*uint8)(6),
  Priority: (*uint8)(14),
  Timestamp: (*time.Time)(0000-12-21 10:35:00 +0000 UTC),
  Hostname: (*string)((len=22) "Flcs-MacBook-Pro.local"),
  Appname: (*string)((len=1) "f"),
  ProcID: (*string)((len=20) "[2022-12-21 18:35:00"),
  MsgID: (*string)(<nil>),
  Message: (*string)(<nil>)
 }
})


Version between range 1 to 999, why ?

Hello,

I am trying to understand why did you choose to reject a version that is not between 1 and 999.

How I am testing

I am testing with a docker container with this command: docker run --log-driver syslog --log-opt syslog-address=udp://localhost:7890 alpine echo hello world

I obtain this syslog message: <30>Aug 8 13:56:23 6d8f79ab82bf[1451]: hello world\n

Docker is using the same RFC as you with the ABNF implementation: https://docs.docker.com/config/containers/logging/syslog/

Why I am thinking version range is not expected ?

In the RFC there is no 999, you can search for it but you will not find anything related to the version.

So why are you doing that, there is a reason for ?

Is this project alive?

It has many open PRs and some of them is more than a few years old.

Is this project alive?

Data race on currentid

var currentid string
var currentparamname string

Those two variables are defined on the package level. That means that two independent rfc5424.SyslogMessage objects with structured data can't be built concurrently – race detector correctly reports unsynchronised writes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.