{"id":20795898,"url":"https://github.com/g41797/syslog2nats","last_synced_at":"2025-07-20T07:34:03.175Z","repository":{"id":196336386,"uuid":"695748103","full_name":"g41797/syslog2nats","owner":"g41797","description":"Syslog sidecar for NATS ","archived":false,"fork":false,"pushed_at":"2023-11-10T08:31:26.000Z","size":16972,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T01:41:33.686Z","etag":null,"topics":["go","jetstream","nats","sidecar","syslog"],"latest_commit_sha":null,"homepage":"https://github.com/g41797/syslogsidecar","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/g41797.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-24T05:08:47.000Z","updated_at":"2023-11-25T07:19:51.000Z","dependencies_parsed_at":"2024-06-21T16:27:03.932Z","dependency_job_id":"458fdd34-1642-4553-9b25-71fc79986813","html_url":"https://github.com/g41797/syslog2nats","commit_stats":null,"previous_names":["g41797/syslog2nats"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/g41797/syslog2nats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g41797%2Fsyslog2nats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g41797%2Fsyslog2nats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g41797%2Fsyslog2nats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g41797%2Fsyslog2nats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g41797","download_url":"https://codeload.github.com/g41797/syslog2nats/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g41797%2Fsyslog2nats/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266085779,"owners_count":23874482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","jetstream","nats","sidecar","syslog"],"created_at":"2024-11-17T16:24:34.560Z","updated_at":"2025-07-20T07:34:03.151Z","avatar_url":"https://github.com/g41797.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# syslog2nats [![Go](https://github.com/g41797/syslog2nats/actions/workflows/go.yml/badge.svg)](https://github.com/g41797/syslog2nats/actions/workflows/go.yml)\n\nReceives syslog messages and publishs them to [NATS](https://nats.io) \n\nsyslog2nats is based on \n- [syslogsidecar](https://github.com/g41797/syslogsidecar#readme)\n- [sputnik](https://github.com/g41797/sputnik)\n\nsyslog2nats consists of:\n- syslog server - common part for all syslogsidecar based processes\n- NATS specific plugins \n\n## Syslog server\n\n Supported RFCs:\n  - [RFC3164](\u003chttps://tools.ietf.org/html/rfc3164\u003e)\n  - [RFC5424](\u003chttps://tools.ietf.org/html/rfc5424\u003e)\n\n\n  RFC3164 message consists of following symbolic parts:\n  - priority\n  - facility \n  - severity\n  - timestamp\n  - hostname\n  - tag\n  - **content**\n\n  ### RFC5424\n\n  RFC5424 message consists of following symbolic parts:\n - priority\n - facility \n - severity\n - timestamp\n - hostname\n - version\n - app_name\n - proc_id\n - msg_id\n - structured_data\n - **message**\n\n### Non-RFC parts\n\n  syslogsidecar adds rfc of produced message:\n  - Part name: \"rfc\"\n  - Values: \"RFC3164\"|\"RFC5424\"\n\n### Badly formatted messages\n\n  syslogsidecar creates only one part for badly formatted message - former syslog message:\n  - Part name: \"data\"\n      \n### Severities\n\n    Valid severity levels and names are:\n\n - 0 emerg\n - 1 alert\n - 2 crit\n - 3 err\n - 4 warning\n - 5 notice\n - 6 info\n - 7 debug\n\n  syslogsidecar filters messages by level according to value in configuration, e.g. for:\n```json\n{\n  \"SEVERITYLEVEL\": 4,\n  ...........\n}\n```\nall messages with severity above 4 will be discarded. \n\n\n  ### Configuration\n\n  Configuration of syslog server part of syslogsidecar is saved in the file syslogreceiver.json:\n```json\n{\n    \"SEVERITYLEVEL\": 4,\n    \"ADDRTCP\": \"127.0.0.1:5141\",\n    \"ADDRUDP\": \"127.0.0.1:5141\",\n    \"UDSPATH\": \"\",\n    \"ADDRTCPTLS\": \"127.0.0.1:5143\",\n    \"CLIENT_CERT_PATH\": \"\",\n    \"CLIENT_KEY_PATH \": \"\",\n    \"ROOT_CA_PATH\": \"\"\n}\n```\n\n### Links\n\n- More complete description of [syslogsidecar](https://github.com/g41797/syslogsidecar#readme)\n- syslog for [Memphis](https://memphis.dev) is part of [memphis-protocol-adapter](https://github.com/g41797/memphis-protocol-adapter) project\n\n\n## Plugins\n\n  NATS plugins to syslogsidecar:\n  - [connector](https://github.com/g41797/syslog2nats/blob/main/connector.go)\n  - [producer](https://github.com/g41797/syslog2nats/blob/main/msgproducer.go)\n  - [consumer](https://github.com/g41797/syslog2nats/blob/main/msgconsumer.go) (used for the tests)\n\n\n### Connector\n\nConfiguration file: connector.json\n```json\n{\n    \"CONN_URL\": \"nats://127.0.0.1:4222\"\n}\n```\nThe rest of connection options are default.\n\nConnector creates sharable _*nats.Conn*_ for:\n- periodic validation of connectivity with memphis\n- using by producer (production) and consumer (e2e test)\n\nMore about connector and underlying software - [sputnik](https://github.com/g41797/sputnik#readme)\n\n### Producer\n\nConfiguration file: syslogproducer.json\n```json\n{\n    \"STREAM\": \"syslog\"\n}\n```\n\nProducer uses received from connector _*nats.Conn*_.\nIt created JETSTREAM with name from configuration, the rest of stream options are default.\n\nsyslog messages are produced to jetstream as *Header* with _*empty payload*_:\n```go\n    .................................\n    msg := \u0026nats.Msg{\n\t\tSubject: name,\n\t\tHeader:  make(nats.Header),\n\t}\n\n\tputToheader := func(name string, value string) error {\n\t\tmsg.Header.Add(name, value)\n\t\treturn nil\n\t}\n\n\tsyslogsidecar.Unpack(inmsg, putToheader)\n    .................................\n```\n\nsee also [Advanced configuration and helper functions for producer](https://github.com/g41797/syslogsidecar#advanced-configuration-and-helper-functions-for-producer)\n\n## Build and run under vscode\n\n```bash\ngo clean -cache -testcache\ngo build ./cmd/syslog2nats/\n./syslog2nats --cf ./cmd/syslog2nats/conf/\n```\n\n## e2e test\n\nSimultaneuosly:  \n- send 1000000 syslog messages\n   - TCP/IP\n   - RFC5424\n- receive\n- produce\n- consume\n- compare\n\nBuild and run under vscode:\n```bash\ngo clean -cache -testcache\ngo build ./cmd/syslog-e2e/\n./syslog-e2e \n```\nnats server runs as as part of syslog-e2e process.\n\n## Embedding configuration files\n\nsyslog-e2e uses embedded configuration files:\n```go\nimport (\n\t\"embed\"\n  .........\n)\n\n//go:embed conf\nvar embconf embed.FS\n\nfunc main() {\n  ............................\n  ............................\n\tcleanUp, _ := sidecar.UseEmbeddedConfiguration(\u0026embconf)\n\tdefer cleanUp()\n\tsidecar.Start(syslog2nats.NewConnector())\n}\n\n```\nFor this case content of **conf** subfolder embedded within process.\nNo needs for \"--cf\" flag in command line.\n\nAny value in configuration file may be [overridden using environment variables](https://github.com/g41797/gonfig#gonfig-)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg41797%2Fsyslog2nats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg41797%2Fsyslog2nats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg41797%2Fsyslog2nats/lists"}