{"id":19336991,"url":"https://github.com/eddort/logredact","last_synced_at":"2026-06-09T20:31:05.331Z","repository":{"id":149994878,"uuid":"622513356","full_name":"eddort/logredact","owner":"eddort","description":"Logredact is a Logrus hook for removing sensitive information from log entries","archived":false,"fork":false,"pushed_at":"2023-04-02T15:29:59.000Z","size":14,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T08:14:01.619Z","etag":null,"topics":["go","golang","logging","logrus","logrus-hook"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddort.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-04-02T10:47:15.000Z","updated_at":"2023-06-18T10:42:28.000Z","dependencies_parsed_at":"2023-06-12T06:45:40.939Z","dependency_job_id":null,"html_url":"https://github.com/eddort/logredact","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/eddort/logredact","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Flogredact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Flogredact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Flogredact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Flogredact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddort","download_url":"https://codeload.github.com/eddort/logredact/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Flogredact/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34125332,"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-09T02:00:06.510Z","response_time":63,"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","golang","logging","logrus","logrus-hook"],"created_at":"2024-11-10T03:13:06.706Z","updated_at":"2026-06-09T20:31:05.304Z","avatar_url":"https://github.com/eddort.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logrus Secret Remover Hook\n\nLogredact is a Logrus hook for removing sensitive information from log entries. This module can help you protect secrets in your logs by redacting them before the logs are written.\n\n## Installation\n\nTo install the `logredact`, run the following command:\n\n```sh\ngo get github.com/eddort/logredact\n```\n\n## Usage\n\nTo use the logredact, import it in your Go code and add it to your Logrus logger. Here's an example:\n\n```go\npackage main\n\nimport (\n\t\"github.com/eddort/logredact\"\n\t\"github.com/sirupsen/logrus\"\n)\n\nfunc main() {\n\tlogger := logrus.New()\n\n\tsecrets := []string{\"supersecret\", \"anothersecret\"}\n\tsecretHook := logredact.New(secrets, \"***\")\n\n\tlogger.AddHook(secretHook)\n\n\tlogger.Info(\"This log entry contains a supersecret token.\")\n}\n\n```\n\nIn this example, we create a new Logrus logger, create a new secret remover hook with a list of secrets to redact, and add the hook to the logger. When we log an entry containing one of the secrets, the hook will replace the secret with `***`.\n\nExample with Go structure logging:\n\n```go\npackage main\n\nimport (\n\t\"github.com/sirupsen/logrus\"\n\t\"github.com/eddort/logredact\"\n)\n\ntype MyStruct struct {\n\tUsername string\n\tPassword string\n}\n\nfunc main() {\n\tlogger := logrus.New()\n\tlogger.SetFormatter(\u0026logrus.JSONFormatter{})\n\n\tsecrets := []string{\"mysecret1\", \"mysecret2\"}\n\n\thook := logredact.New(secrets)\n\t\n\tlogger.AddHook(hook)\n\n\tlogger.Info(\"This is a log entry with mysecret1 and mysecret2\")\n\n\tmyData := MyStruct{\n\t\tUsername: \"myuser\",\n\t\tPassword: \"mysecret1\",\n\t}\n\n\t// Logging an object with sensitive data using WithFields\n\tlogger.WithFields(logrus.Fields{\n\t\t\"my_struct\": myData,\n\t}).Info(\"Logging a Go struct with sensitive data\")\n}\n\n```\n\n## Configuration\n\nThe logredact takes an array of strings as first argument and `replacer` as the second argument. These strings represent the secrets you want to remove from your log entries. You can add as many secrets as needed:\n\n```go\nsecrets := []string{\"secret1\", \"secret2\", \"secret3\"}\nsecretHook := logredact.New(secrets, \"***\")\n```\n\n## Contributing\n\nIf you'd like to contribute to the project, feel free to submit a pull request or open an issue.\n\n## License\n\nThis module is released under the [MIT License](https://opensource.org/license/mit/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddort%2Flogredact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddort%2Flogredact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddort%2Flogredact/lists"}