{"id":24416738,"url":"https://github.com/sha1n/gostash","last_synced_at":"2025-07-26T12:37:50.616Z","repository":{"id":48684644,"uuid":"156067877","full_name":"sha1n/gostash","owner":"sha1n","description":"A utility on top of logrus for structured logging and tracing in logstash json format.","archived":false,"fork":false,"pushed_at":"2023-01-31T21:56:07.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T08:14:08.538Z","etag":null,"topics":["golang","logging","logrus","logstash","trace"],"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/sha1n.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-11-04T09:44:35.000Z","updated_at":"2023-01-31T21:50:16.000Z","dependencies_parsed_at":"2023-02-16T23:30:56.770Z","dependency_job_id":null,"html_url":"https://github.com/sha1n/gostash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sha1n%2Fgostash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sha1n%2Fgostash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sha1n%2Fgostash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sha1n%2Fgostash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sha1n","download_url":"https://codeload.github.com/sha1n/gostash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243401512,"owners_count":20285060,"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":["golang","logging","logrus","logstash","trace"],"created_at":"2025-01-20T08:14:12.351Z","updated_at":"2025-03-13T12:19:31.115Z","avatar_url":"https://github.com/sha1n.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/sha1n/gostash/actions/workflows/go.yml/badge.svg)](https://github.com/sha1n/gostash/actions/workflows/go.yml)\n\n# gostash\n\nA utility on top of [logrus](https://github.com/sirupsen/logrus) for structured logging and tracing in logstash json format. \n\n\n## Usage Example: (see \u003crepo\u003e/example.go)\n```go\npackage main\n\nimport (\n\t\"github.com/sha1n/gostash/logging\"\n)\n\nfunc main() {\n\tlogging.SetLogConfig(\n\t\tlogging.Config{\n\t\t\tFileName: \"./test.log\",\n\t\t\tLevel:    \"info\",\n\t\t\tProperties: logging.LogProperties{\n\t\t\t\tDcName:       \"east\",\n\t\t\t\tServiceName:  \"my-service\",\n\t\t\t\tInstanceName: \"my-instance\",\n\t\t\t},\n\t\t})\n\n\tbaseEntry := logging.\n\t\tNewEntry(\"test\").\n\t\tWithField(\"user\", \"me\")\n\n\t// start a trace segment\n\ttraceSegment := logging.\n\t\tNewTrace(\"traceAction\", baseEntry).\n\t\tStartSegment(\"segment-1\")\n\n\t// your business logic here...\n\n\n\t// end a trace segment with error\n\ttraceSegment.End()\n}\n```\n\n### Segment start document:\n```json\n{\n\t\"@timestamp\": \"2018-11-04T15:35:38.041+02:00\",\n\t\"action\": \"traceAction\",\n\t\"dc\": \"east\",\n\t\"instance\": \"my-instance\",\n\t\"level\": \"info\",\n\t\"marker\": \"start\",\n\t\"message\": \"\",\n\t\"name\": \"test\",\n\t\"segment\": \"segment-1\",\n\t\"service\": \"my-service\",\n\t\"trace_id\": \"81775219-3a91-443c-b77d-b8996337952f\",\n\t\"user\": \"me\"\n}\n```\n\n### Segment end document:\n```json\n{\n\t\"@timestamp\": \"2018-11-04T15:35:38.041+02:00\",\n\t\"action\": \"traceAction\",\n\t\"dc\": \"east\",\n\t\"duration_sec\": 0.000062782,\n\t\"instance\": \"my-instance\",\n\t\"level\": \"info\",\n\t\"marker\": \"end\",\n\t\"message\": \"\",\n\t\"name\": \"test\",\n\t\"segment\": \"segment-1\",\n\t\"service\": \"my-service\",\n\t\"trace_id\": \"81775219-3a91-443c-b77d-b8996337952f\",\n\t\"user\": \"me\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsha1n%2Fgostash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsha1n%2Fgostash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsha1n%2Fgostash/lists"}