{"id":23960378,"url":"https://github.com/d0x7/go-gelf","last_synced_at":"2026-06-12T18:33:51.780Z","repository":{"id":271147331,"uuid":"912541276","full_name":"d0x7/go-gelf","owner":"d0x7","description":"Go library to send logs to Graylog as GELF via TCP, UDP and HTTP","archived":false,"fork":false,"pushed_at":"2025-03-06T22:06:19.000Z","size":83,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T23:19:49.607Z","etag":null,"topics":["go","library"],"latest_commit_sha":null,"homepage":"","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/d0x7.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":"2025-01-05T21:20:58.000Z","updated_at":"2025-03-06T22:06:15.000Z","dependencies_parsed_at":"2025-03-06T23:19:39.962Z","dependency_job_id":"8c287da9-306f-4ea4-a631-e30d3816e7ce","html_url":"https://github.com/d0x7/go-gelf","commit_stats":null,"previous_names":["d0x7/go-gelf"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/d0x7/go-gelf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d0x7%2Fgo-gelf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d0x7%2Fgo-gelf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d0x7%2Fgo-gelf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d0x7%2Fgo-gelf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d0x7","download_url":"https://codeload.github.com/d0x7/go-gelf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d0x7%2Fgo-gelf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34258368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["go","library"],"created_at":"2025-01-06T19:27:45.814Z","updated_at":"2026-06-12T18:33:51.772Z","avatar_url":"https://github.com/d0x7.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-gelf - GELF Library and Writer for Go\n========================================\n\n[GELF] (Graylog Extended Log Format) is an application-level logging\nprotocol that avoids many of the shortcomings of [syslog]. While it\ncan be run over any stream or datagram transport protocol, it has\nspecial support ([chunking]) to allow long messages to be split over\nmultiple datagrams.\n\nVersions\n--------\n\nThis was forked from [Graylog2 go-gelf](https://github.com/Graylog2/go-gelf) to add the GELF HTTP transport protocol.\n\nCurrently sending GELF is supported via UDP, TCP and HTTP.\nTLS is experimental in the tls branch.\n\nThe library provides an API that applications can use to log messages\ndirectly to a Graylog server and an `io.Writer` that can be used to\nredirect the standard library's log messages (`os.Stdout`) to a\nGraylog server.\n\n[GELF]: http://docs.graylog.org/en/2.2/pages/gelf.html\n[syslog]: https://tools.ietf.org/html/rfc5424\n[chunking]: http://docs.graylog.org/en/2.2/pages/gelf.html#chunked-gelf\n\n\nInstalling\n----------\n\nTo install, run:\n\n    go get xiam.li/gelf\n\nUsage\n-----\n\nThe easiest way to integrate graylog logging into your go app is by\nhaving your `main` function (or even `init`) call `log.SetOutput()`.\nBy using an `io.MultiWriter`, we can log to both stdout and graylog -\ngiving us both centralized and local logs.  (Redundancy is nice).\n\n```golang\npackage main\n\nimport (\n\t\"flag\"\n\t\"io\"\n\t\"log\"\n\t\"os\"\n\t\"xiam.li/gelf\"\n)\n\nfunc main() {\n\tvar graylogAddr string\n\n\tflag.StringVar(\u0026graylogAddr, \"graylog\", \"\", \"graylog server addr\")\n\tflag.Parse()\n\n\tif graylogAddr != \"\" {\n\t\t// If using UDP\n\t\tgelfWriter, err := gelf.NewUDPWriter(graylogAddr)\n\t\t// If using TCP\n\t\t//gelfWriter, err := gelf.NewTCPWriter(graylogAddr)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"gelf.NewWriter: %s\", err)\n\t\t}\n\t\t// log to both stderr and graylog2\n\t\tlog.SetOutput(io.MultiWriter(os.Stderr, gelfWriter))\n\t\tlog.Printf(\"logging to stderr \u0026 graylog2@'%s'\", graylogAddr)\n\t}\n\n\t// From here on out, any calls to log.Print* functions\n\t// will appear on stdout, and be sent over UDP or TCP to the\n\t// specified Graylog2 server.\n\n\tlog.Printf(\"Hello gray World\")\n\n\t// ...\n}\n```\nThe above program can be invoked as:\n\n    go run test.go -graylog=localhost:12201\n\nWhen using UDP messages may be dropped or re-ordered. However, Graylog\nserver availability will not impact application performance; there is\na small, fixed overhead per log call regardless of whether the target\nserver is reachable or not.\n\n\nTo Do\n-----\n\n- WriteMessage example\n\nLicense\n-------\n\ngo-gelf is offered under the MIT license, see LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd0x7%2Fgo-gelf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd0x7%2Fgo-gelf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd0x7%2Fgo-gelf/lists"}