{"id":37139445,"url":"https://github.com/jackfazackerley/logrus-opsgenie-hook","last_synced_at":"2026-01-14T16:04:15.242Z","repository":{"id":57507314,"uuid":"147262252","full_name":"JackFazackerley/logrus-opsgenie-hook","owner":"JackFazackerley","description":"Hook for logrus that sends errors to OpsGenie as alerts.","archived":false,"fork":false,"pushed_at":"2018-09-03T23:46:54.000Z","size":4,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-15T01:47:37.118Z","etag":null,"topics":["golang","logging","logrus","opsgenie"],"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/JackFazackerley.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":"2018-09-03T23:14:37.000Z","updated_at":"2018-09-04T12:34:50.000Z","dependencies_parsed_at":"2022-09-26T18:31:30.839Z","dependency_job_id":null,"html_url":"https://github.com/JackFazackerley/logrus-opsgenie-hook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JackFazackerley/logrus-opsgenie-hook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackFazackerley%2Flogrus-opsgenie-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackFazackerley%2Flogrus-opsgenie-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackFazackerley%2Flogrus-opsgenie-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackFazackerley%2Flogrus-opsgenie-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JackFazackerley","download_url":"https://codeload.github.com/JackFazackerley/logrus-opsgenie-hook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JackFazackerley%2Flogrus-opsgenie-hook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28425597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T15:24:48.085Z","status":"ssl_error","status_checked_at":"2026-01-14T15:23:41.940Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["golang","logging","logrus","opsgenie"],"created_at":"2026-01-14T16:04:14.412Z","updated_at":"2026-01-14T16:04:15.226Z","avatar_url":"https://github.com/JackFazackerley.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpsGenie Hook for Logrus \u003cimg src=\"http://i.imgur.com/hTeVwmJ.png\" width=\"40\" height=\"40\" alt=\":walrus:\" class=\"emoji\" title=\":walrus:\" /\u003e\u0026nbsp;[![Build Status](https://travis-ci.org/JackFazackerley/logrus-opsgenie-hook.svg?branch=master)](https://travis-ci.org/JackFazackerley/logrus-opsgenie-hook)\u0026nbsp;[![godoc reference](https://godoc.org/github.com/JackFazackerley/logrus-opsgenie-hook?status.png)](https://godoc.org/github.com/JackFazackerley/logrus-opsgenie-hook)\n\nThis hook is used to send your errors to [OpsGenie](https://www.opsgenie.com/) as an alert. It uses the [opsgenie-go-sdk](https://github.com/opsgenie/opsgenie-go-sdk) to handle the requests. The levels that are blocked by this hook are `log.Error`, `log.Fatal`, and `log.Panic`.\n\n## Usage\n\nThe only configuration needed for this hook is the OpsGenie API key you wish to use. However the alert struct must be created yourself with the fields you wish to use and added as a `logrus.Entry` using `WithField(\"request\", alert)`.\n\nThe message of the alert will default to the log level message: `Error(\"some error\")`, although if `WithError(err)` is used that will become a priority.\n\n```go\nimport (\n    \"fmt\"\n\n    \"github.com/jackfazackerley/logrus-opsgenie-hook\"\n    \"github.com/opsgenie/opsgenie-go-sdk/alertsv2\"\n    \"github.com/sirupsen/logrus\"\n)\n\nfunc main() {\n    log := logrus.New()\n\n    hook, err := opsgenie.NewHook(\"some API key\")\n    if err != nil {\n        panic(err)\n    }\n\n    log.AddHook(hook)\n\n    alert := alertsv2.CreateAlertRequest{\n        Alias: \"some alias here\",\n        Description: \"some description here\",\n        Teams: []alertsv2.TeamRecipient{\n            \u0026alertsv2.Team{\n                Name: \"Dev\",\n            },\n        },\n        Source:   \"some source here\",\n        Priority: alertsv2.P5,\n    }\n\n    // Uses default message as the alert message\n    log.WithField(\"alert\", alert).Error(\"default message value\")\n\n    // WithError is made priority for the alert message\n    log.WithField(\"alert\", alert).WithError(fmt.Errorf(\"made priority\")).Error(\"default message value\")\n}\n```\n\nThe structure for the OpsGenie alert is documented [Here](https://godoc.org/github.com/opsgenie/opsgenie-go-sdk/alertsv2#CreateAlertRequest).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackfazackerley%2Flogrus-opsgenie-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackfazackerley%2Flogrus-opsgenie-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackfazackerley%2Flogrus-opsgenie-hook/lists"}