{"id":13547522,"url":"https://github.com/getsentry/sentlog","last_synced_at":"2025-03-23T03:23:13.704Z","repository":{"id":66037094,"uuid":"193668016","full_name":"getsentry/sentlog","owner":"getsentry","description":"CLI util for parsing arbitrary text data and sending error-like events to Sentry","archived":false,"fork":false,"pushed_at":"2023-08-27T02:57:08.000Z","size":38,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-22T06:47:09.045Z","etag":null,"topics":["go","golang","grok","logging","sentry","tag-non-production"],"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/getsentry.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},"funding":{"custom":["https://sentry.io/pricing/","https://sentry.io/"]}},"created_at":"2019-06-25T08:35:25.000Z","updated_at":"2023-12-05T19:30:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"6834b75d-d4f9-45e1-9932-98beeabebb51","html_url":"https://github.com/getsentry/sentlog","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsentry%2Fsentlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsentry%2Fsentlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsentry%2Fsentlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsentry%2Fsentlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getsentry","download_url":"https://codeload.github.com/getsentry/sentlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245049832,"owners_count":20552734,"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":["go","golang","grok","logging","sentry","tag-non-production"],"created_at":"2024-08-01T12:00:57.449Z","updated_at":"2025-03-23T03:23:13.676Z","avatar_url":"https://github.com/getsentry.png","language":"Go","readme":"# sentlog \u003c!-- omit in toc --\u003e\n\n## This is a Sentry Hackweek project! Development may stop anytime. You've been warned.\u003c!-- omit in toc --\u003e\n\n`sentlog` is a command-line tool that can read arbitrary text files (e.g., webserver or database logs), search for specific user-defined patterns, and report the findings to Sentry.\n\n## Table of Contents \u003c!-- omit in toc --\u003e\n- [Introduction](#Introduction)\n- [Downloads](#Downloads)\n- [Command Line Arguments](#Command-Line-Arguments)\n- [Example](#Example)\n- [Configuration File](#Configuration-File)\n- [About Patterns](#About-Patterns)\n\n## Introduction\n\nSentry provides SDKs for a lot of different [platforms and frameworks](https://docs.sentry.io/). However, you might also want to use Sentry for parts of your infrastructure that were not developed by you, or don't have an integration with Sentry (yet): databases, web servers, and even operating system kernels. What do these tools have in common? They normally have some sort of output (i.e. logs), where both regular events and errors are usually logged. So why not parsing those logs and look for entries that look like errors? We can do that. And what platform do we usually use for error management? Sentry, of course!\n\nAnd this is when `sentlog` steps in.\n\n## Downloads\n\n`sentlog` binaries can be downloaded from [GitHub releases](https://github.com/getsentry/sentlog/releases).\n\n## Command Line Arguments\n\n```sh\nusage: sentlog [\u003cflags\u003e] [\u003cfile\u003e]\n\nFlags:\n      --help             Show context-sensitive help (also try --help-long and --help-man).\n  -p, --pattern=PATTERN  Pattern to look for\n      --dry-run          Dry-run mode\n      --no-follow        Do not wait for the new data\n      --from-line=-1     Start reading from this line number\n  -c, --config=CONFIG    Path to the configuration\n  -v, --verbose          Print every match\n\nArgs:\n  [\u003cfile\u003e]  File to parse\n```\n\n`sentlog` can operate in two modes:\n\n1. Basic: filename and pattern are specified on the command line\n2. Advanced: using the configuration file provided by `--config` argument\n\n## Example\n\nThe following example shows how you can run `sentlog` in Basic mode.\n\n```sh\nexport SENTLOG_SENTRY_DSN=\"https://XXX@sentry.io/YYY\"   # Your Sentry DSN\nsentlog /var/log/postgresql/postgresql-9.6.log \\\n        -p '^%{DATESTAMP:timestamp}.*FATAL:.*host \"%{IP:host}\", user \"%{USERNAME:user}\", database \"%{WORD:database}\"'\n```\n\n...will watch the PostgreSQL log (`/var/log/postgresql/postgresql-9.6.log`) for events that look like this:\n\n```\n2019-05-21 08:51:09 GMT [11212]: FATAL: no pg_hba.conf entry for host \"123.123.123.123\", user \"postgres\", database \"testdb\"\n```\n\n`sentlog` will extract the timestamp, IP address, username, and database from the entry, and will add them as tags to the Sentry event.\n\n## Configuration File\n\n```yaml\n---\n# Sentry DSN (also can be configured via environment)\nsentry_dsn: https://XXX@sentry.io/YYY\n# Additional Grok pattern files\npattern_files:\n  - ./patterns1.txt\n  - ../patterns2.txt\n\n# List of files that we want to watch\ninputs:\n  - file: /var/log/nginx/error.log\n    # Patterns to find and report\n    patterns:\n      - \"%{NGINX_ERROR_LOG}\"\n    # Additional tags that will be added to the Sentry event\n    tags:\n      pattern: nginx_error\n      custom: tag\n```\n\n## About Patterns\n\n`sentlog` uses [Grok patterns](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html#_grok_basics) to match your data. A cool thing about Grok expressions is that they can be nested, which lets you to define complex matching expressions based on smaller building blocks ([example](https://github.com/vjeantet/grok/blob/5a86c829f3c347ec23dbd632af2db0d3508c11ce/patterns/grok-patterns)).\n\nThis Grok debugger can be quite helpful when preparing your Grok expressions: https://grokdebug.herokuapp.com/\n","funding_links":["https://sentry.io/pricing/","https://sentry.io/"],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetsentry%2Fsentlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetsentry%2Fsentlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetsentry%2Fsentlog/lists"}