{"id":37131861,"url":"https://github.com/ericlagergren/syslog","last_synced_at":"2026-01-14T15:17:26.820Z","repository":{"id":57635698,"uuid":"53222342","full_name":"ericlagergren/syslog","owner":"ericlagergren","description":"Golang package that is a drop-in replacement for the standard library log/syslog, but with extra features.","archived":false,"fork":true,"pushed_at":"2016-03-05T22:25:45.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T11:03:50.801Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"RackSec/srslog","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericlagergren.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}},"created_at":"2016-03-05T20:42:35.000Z","updated_at":"2016-03-05T22:05:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ericlagergren/syslog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ericlagergren/syslog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericlagergren%2Fsyslog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericlagergren%2Fsyslog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericlagergren%2Fsyslog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericlagergren%2Fsyslog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericlagergren","download_url":"https://codeload.github.com/ericlagergren/syslog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericlagergren%2Fsyslog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28424122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T15:17:25.998Z","updated_at":"2026-01-14T15:17:26.812Z","avatar_url":"https://github.com/ericlagergren.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/EricLagergren/syslog.svg?branch=master)](https://travis-ci.org/EricLagergren/syslog)\n\n# syslog\n\nGo has a `syslog` package in the [standard library](https://golang.org/pkg/log/syslog/), but it has the following\nshortcomings:\n\n1. It doesn't have TLS support\n2. [According to @bradfitz, it is no longer being maintained.](https://github.com/golang/go/issues/13449#issuecomment-161204716)\n\nThis code was taken directly from the Go project as a base to start from.\n\nHowever, this _does_ have TLS support.\n\n# Usage\n\nBasic usage retains the same interface as the original `syslog` package.\n\nSwitch from the standard library:\n\n```\nimport \"github.com/EricLagergren/syslog\"\n```\n\nYou can still use it for local syslog:\n\n```\nw, err := syslog.Dial(\"\", \"\", syslog.LOG_ERR, \"testtag\")\n```\n\nOr to unencrypted UDP:\n\n```\nw, err := syslog.Dial(\"udp\", \"192.168.0.50:514\", syslog.LOG_ERR, \"testtag\")\n```\n\nOr to unencrypted TCP:\n\n```\nw, err := syslog.Dial(\"tcp\", \"192.168.0.51:514\", syslog.LOG_ERR, \"testtag\")\n```\n\nBut now you can also send messages via TLS-encrypted TCP:\n\n```\nw, err := syslog.DialWithTLSCertPath(\"tcp+tls\", \"192.168.0.52:514\", syslog.LOG_ERR, \"testtag\", \"/path/to/servercert.pem\")\n```\n\nAnd if you need more control over your TLS configuration :\n\n```\npool := x509.NewCertPool()\nserverCert, err := ioutil.ReadFile(\"/path/to/servercert.pem\")\nif err != nil {\n    return nil, err\n}\npool.AppendCertsFromPEM(serverCert)\nconfig := tls.Config{\n    RootCAs: pool,\n}\n\nw, err := DialWithTLSConfig(network, raddr, priority, tag, \u0026config)\n```\n\n(Note that in both TLS cases, this uses a self-signed certificate, where the\nremote syslog server has the keypair and the client has only the public key.)\n\nAnd then to write log messages, continue like so:\n\n```\nif err != nil {\n    log.Fatal(\"failed to connect to syslog:\", err)\n}\ndefer w.Close()\n\nw.Alert(\"this is an alert\")\nw.Crit(\"this is critical\")\nw.Err(\"this is an error\")\nw.Warning(\"this is a warning\")\nw.Notice(\"this is a notice\")\nw.Info(\"this is info\")\nw.Debug(\"this is debug\")\nw.Write([]byte(\"these are some bytes\"))\nW.WriteString(\"these are more byte\")\n```\n\n# Generating TLS Certificates\n\nProvided is a script that you can use to generate a self-signed keypair:\n\n```\npip install cryptography\npython script/gen-certs.py\n```\n\nThat outputs the public key and private key to standard out. Put those into\n`.pem` files. (And don't put them into any source control. The certificate in\nthe `test` directory is used by the unit tests, and please do not actually use\nit anywhere else.)\n\n# Running Tests\n\nRun the tests as usual:\n\n```\ngo test\n```\n\nBut also provided is a test coverage script that will show you which\nlines of code are not covered:\n\n```\nscript/coverage --html\n```\n\nThat will open a new browser tab showing coverage information.\n\n# License\n\nThis project uses the New BSD License, same as the Go project itself.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericlagergren%2Fsyslog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericlagergren%2Fsyslog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericlagergren%2Fsyslog/lists"}