{"id":13523392,"url":"https://github.com/ingyamilmolinar/doctorgpt","last_synced_at":"2026-01-12T03:01:57.575Z","repository":{"id":152400150,"uuid":"615913453","full_name":"ingyamilmolinar/doctorgpt","owner":"ingyamilmolinar","description":"DoctorGPT brings GPT into production for application log error diagnosing!","archived":false,"fork":false,"pushed_at":"2023-05-10T01:20:55.000Z","size":7600,"stargazers_count":205,"open_issues_count":0,"forks_count":13,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-01T00:33:51.758Z","etag":null,"topics":["application","chatgpt","diagnosis","diagnostics","error","gpt","log","log-analysis","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/ingyamilmolinar.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}},"created_at":"2023-03-19T03:25:44.000Z","updated_at":"2025-03-22T21:49:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"97e36991-aa2b-4606-929a-8c2a8dbc4e59","html_url":"https://github.com/ingyamilmolinar/doctorgpt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ingyamilmolinar/doctorgpt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingyamilmolinar%2Fdoctorgpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingyamilmolinar%2Fdoctorgpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingyamilmolinar%2Fdoctorgpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingyamilmolinar%2Fdoctorgpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ingyamilmolinar","download_url":"https://codeload.github.com/ingyamilmolinar/doctorgpt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingyamilmolinar%2Fdoctorgpt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28332841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"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":["application","chatgpt","diagnosis","diagnostics","error","gpt","log","log-analysis","production"],"created_at":"2024-08-01T06:00:59.640Z","updated_at":"2026-01-12T03:01:57.560Z","avatar_url":"https://github.com/ingyamilmolinar.png","language":"Go","funding_links":[],"categories":["Tools for Self-Hosting","Continuous Monitoring","Go","Packages","CLI","Tools","A01_文本生成_文本对话","ChatGPT Integrated Projects","Continous Monitoring","UIs"],"sub_categories":["Running Locally on Windows, MacOS, and Linux:","Container Orchestration","Go","Special-purpose","Open-source projects","大语言对话模型及数据","Command-line(shell) interface"],"readme":"# DoctorGPT\nDoctorGPT brings GPT into production for error diagnosing!\n(Not production ready, yet...)\n\nDoctorGPT is a lightweight self-contained binary that monitors your application logs for problems and diagnoses them.\n\n## Usage\n`OPENAI_KEY=$YOUR_KEY doctorgpt --logfile=\"program.log\" --configfile=\"config.yaml\" --outdir=\"~/errors\"`\n\nDoctorGPT will start tailing `program.log` (without stopping). For each log line, user-defined parsers triggering a diagnosis event (based on regex variable matches) will generate a diagnosis file (see example below) under directory `~/errors` using the triggered log line and all previous log context using the OpenAI API. `config.yaml` file is used at startup to configure the program.\n\n## CLI flags\n- `--logfile (string)` log file to tail and monitor\n- `--configfile (string)` yaml config file location\n- `--outdir (string)` diagnosis files directory (created if it does not exist)\n- `--bundlingtimeoutseconds (int)` wait some time for logs to come-in after the triggered line (for multi-line error dumps) (`default: 5`)\n- `--debug (bool)` debug logging (`default: true`)\n- `--buffersize (int)` maximum number of log entries per buffer  (`default: 100`)\n- `--maxtokens (int)` maximum number of tokens allowed in API (`default: 8000`)\n- `--gptmodel (string)` GPT model to use (`default: \"gpt-4\"`). For list of models see: [OpenAI API Models](https://platform.openai.com/docs/models/overview)\n\n## Configuration\nSee example yaml documentation:\n```yaml\n# Prompt to be sent alongside error context to the GPT API\nprompt: \"You are ErrorDebuggingGPT. Your sole purpose in this world is to help software engineers by diagnosing software system errors and bugs that can occur in any type of computer system. The message following the first line containing \\\"ERROR:\\\" up until the end of the prompt is a computer error no more and no less. It is your job to try to diagnose and fix what went wrong. Ready?\\nERROR:\\n$ERROR\"\n\nparsers:\n\n  # Matches line: [1217/201832.950515:ERROR:cache_util.cc(140)] Unable to move cache folder GPUCache to old_GPUCache_000\n  - regex: '^\\[(\\d{4}\\/\\d{6}\\.\\d{6}):(?P\u003cLEVEL\u003e\\w+):([\\w\\.\\_]+)\\(\\d+\\)\\]\\s+(?P\u003cMESSAGE\u003e.*)$'\n\n    # Conditions in which the parsed log will trigger a diagnosis\n    triggers:\n      - variable: \"LEVEL\"\n        regex:    \"ERROR\"\n\n    # Conditions in which the parsed log will be ignored for triggers\n    # To create exceptions which won't trigger the GPT API\n    filters:\n      - variable: \"MESSAGE\"\n        regex:    \"HTTP 401\"\n\n    # Conditions in which the parsed log will be ignored and excluded from the API context\n    # For sensitive or spammy log entries. These will never be sent to the GPT API\n    excludes:\n      - variable: \"LEVEL\"\n        regex:    \"DEBUG\"\n\n  # Matches line:  2022-01-27 21:37:36.776 0x2eb3     Default       511 photolibraryd: PLModelMigration.m:314   Creating sqlite error indicator file\n  - regex: '^(?P\u003cDATE\u003e[^ ]+)\\s+(?P\u003cTIME\u003e[^ ]+)\\s+[^ ]+(?P\u003cLEVEL\u003e[^ ]+)\\s+(?P\u003cMESSAGE\u003e.*)$'\n\n  # When more than one trigger is present, just one trigger is sufficient to trigger a diagnosis\n    triggers:\n      - variable: \"LEVEL\"\n        regex:    \"Default\"\n      - variable: \"MESSAGE\"\n        regex:    \"(?i)ERROR:\"\n    # Filters and excludes were not specified\n\n  # Last parser must always be a generic one that matches any line\n  - regex: '^(?P\u003cMESSAGE\u003e.*)$'\n    # All filters, triggers and excludes were not specified\n```\n\n## Example\nThis is how the file `::Users::yamilmolinar::error.log:18.diagnosed` file looks like:\n```\nLOG LINE:\n/Users/yamilmolinar/error.log:18\n\nBASE PROMPT:\n You are ErrorDebuggingGPT. Your sole purpose in this world is to help software engineers by diagnosing software system errors and bugs that can occur in any type of computer system. The message following the first line containing \\\"ERROR:\\\" up until the end of the prompt is a computer error no more and no less. It is your job to try to diagnose and fix what went wrong. Ready?\\nERROR:\\n$ERROR\n\nCONTEXT:\nyarn run v1.22.19\n$ tsnd --respawn --transpile-only --no-notify --ignore-watch node_modules src/index.ts\n[INFO] 15:20:25 ts-node-dev ver. 2.0.0 (using ts-node ver. 10.8.0, typescript ver. 4.8.4)\n[INFO]  DB ready\n[INFO]  Auth ready\n[INFO]  Apollo setup\n[INFO]  Server started at http://localhost:5555/graphql 🚀\n\nQuery: Me\nPOST /graphql 200 241.389 ms - 21\n\nprisma:query SELECT 1\nprisma:query SELECT \"public\".\"User\".\"id\", \"public\".\"User\".\"email\", \"public\".\"User\".\"password\", \"public\".\"User\".\"firstName\", \"public\".\"User\".\"lastName\", \"public\".\"User\".\"avatar\", \"public\".\"User\".\"role\", \"public\".\"User\".\"bio\", \"public\".\"User\".\"createdAt\", \"public\".\"User\".\"updatedAt\" FROM \"public\".\"User\" WHERE \"public\".\"User\".\"email\" = $2 LIMIT $2 OFFSET $3\n[ERROR]  PrismaClientKnownRequestError:\nInvalid `prisma.user.findFirst()` invocation in\n/Users/yamilmolinar/Repos/boilerplate/packages/api/src/modules/user/user.service.ts:32:36\n\n  29 }\n  30\n  31 async checkUserExists(where: UserWhereInput) {\n→ 32   const user = await prisma.user.findFirst(\nThe table `public.User` does not exist in the current database.\n    at RequestHandler.handleRequestError (/Users/yamilmolinar/Repos/boilerplate/node_modules/@prisma/client/runtime/index.js:30851:13)\n    at RequestHandler.request (/Users/yamilmolinar/Repos/boilerplate/node_modules/@prisma/client/runtime/index.js:30834:12)\n    at PrismaClient._request (/Users/yamilmolinar/Repos/boilerplate/node_modules/@prisma/client/runtime/index.js:31812:16)\n    at UserService.checkUserExists (/Users/yamilmolinar/Repos/boilerplate/packages/api/src/modules/user/user.service.ts:32:18)\n    at UserService.register (/Users/yamilmolinar/Repos/boilerplate/packages/api/src/modules/user/user.service.ts:26:5)\n    at UserResolver.register (/Users/yamilmolinar/Repos/boilerplate/packages/api/src/modules/user/user.resolver.ts:93:18)\n    at dispatchHandler (/Users/yamilmolinar/Repos/boilerplate/node_modules/type-graphql/dist/resolvers/helpers.js:82:24)\n    at /Users/yamilmolinar/Repos/boilerplate/node_modules/type-graphql/dist/resolvers/helpers.js:83:26\n    at ErrorInterceptor (/Users/yamilmolinar/Repos/boilerplate/packages/api/src/lib/globalMiddleware.ts:29:12)\n    at dispatchHandler (/Users/yamilmolinar/Repos/boilerplate/node_modules/type-graphql/dist/resolvers/helpers.js:82:24) {\n  code: 'P2021',\n  clientVersion: '4.4.0',\n  meta: { table: 'public.User' }\n}\n\nMutation: Register\nPOST /graphql 200 365.616 ms - 2139\n\nDIAGNOSIS:\nIt seems the error is caused by a missing table in the database. The table `public.User` does not exist in the current database, and this is causing the `PrismaClientKnownRequestError` to be thrown when trying to execute `prisma.user.findFirst()` in the `UserService.checkUserExists()` function.\n\nTo resolve this issue, follow these steps:\n\n1. Ensure that you have properly set up your database schema and that the `public.User` table is defined. If it's not, add the necessary schema definition for the User table.\n\n2. Ensure that Prisma is properly configured to connect to your database. Double-check the configuration in your `prisma/schema.prisma` file, and make sure the database URL and other settings are correct.\n\n3. Run a migration to update your actual database's schema. You can do this by running the following command:\n\nnpx prisma migrate dev --name init --preview-feature\n\nThis command will create the necessary tables in your database based on your Prisma schema file, apply the migration, and generate the Prisma Client.\n\n4. After running the migration, restart your server and test your application again to ensure that the error is resolved.\n\nIf you still encounter issues, double-check your Prisma configuration, as well as your database connection settings, and ensure your code logic is correct.\n```\n\n## Parser library (to be enhanced)\nA library of common log parsers is contained in `config.yaml`. These parsers were tested against real logs in `testlogs/*_2k.log`. \n\n1. Android\n2. Apache\n3. HDFS\n4. Hadoop\n5. Linux\n6. Mac\n7. Spark\n8. Windows\n\nSee `parsers_test.go` for tests and [loghub](https://github.com/logpai/loghub) for more log samples.\n\n## Installation\nUsing `go install`:\n- `GOBIN=/usr/local/bin go install \"github.com/ingyamilmolinar/doctorgpt/agent\"`\n\n## Dependencies\n1. A `Go` compiler (for building and running tests only)\n2. `docker`  (for development)\n3. `k3d`     (for development)\n4. `kubectl` (for development)\n5. `make`    (for development)\n\n## Features (to be enhanced)\n1. Environment independent self-sufficient lightweight (8.3MB) binary. (Windows support is missing but could be easily added)\n2. Alpine Linux Docker image\n3. Configurable chatGPT prompt\n4. Supports every GPT model version\n5. Match multiple log formats within the same file\n6. Match multiple parsers for the same log entry\n7. Match multiple filters for the same log entry\n8. Ignore logs from being part of the context (for sensitive or spammy information)\n9. Support custom variable names\n10. Powerful regex format (Perl/Go flavor)\n11. Maximize the amount of log context in the diagnosis\n\n## Work in progress\n1. Dividing log contexts per custom regex match in variable values\n2. Enhance library of common log parsers\n\n## Future work\n1. Structured logging parsing\n2. Generate a config.yaml based on real life log examples (boottrap config using GPT)\n3. \"FROM scratch\" lightweight docker image\n4. Release strategy \u0026 CI\n5. Windows / Mac support\n6. Support custom types (for timestamp comparisons, etc)\n7. Production readiness (security, auth, monitoring, optimization, more tests...)\n8. Sentry SDK integration\n9. Helm chart\n\n## Development\n- `export OPENAI_API=\u003cyour-api-key\u003e`\n- `make k4d-create` (to create k3d cluster)\n- `make k3d-delete` (to delete k3d cluster)\nNOTE: See `Makefile` for more commands\n\n## Testing (Tests do not use OpenAI API)\n- `cd agent; go test ./...; cd -`\n- `cd agent; go test -v ./...; cd -` (verbose mode)\n\n## Contributing\nFeel free to open an issue with your suggestion on how to make this program more useful, portable, efficient and production-ready (and of course BUGS!).\n\nFeel free to open MRs. I'll review them if I see they follow the philosophy of this project. For larger chunks of work or design changes, please open an issue first so that the strategy can be discussed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fingyamilmolinar%2Fdoctorgpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fingyamilmolinar%2Fdoctorgpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fingyamilmolinar%2Fdoctorgpt/lists"}