{"id":18933472,"url":"https://github.com/zjhellofss/lysql","last_synced_at":"2026-03-19T08:30:15.188Z","repository":{"id":88006104,"uuid":"237720415","full_name":"zjhellofss/lysql","owner":"zjhellofss","description":"基于Mysql和C++的一套日志采集分析系统","archived":false,"fork":false,"pushed_at":"2020-02-02T04:57:20.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T20:43:01.563Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/zjhellofss.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":"2020-02-02T04:55:35.000Z","updated_at":"2021-07-14T08:57:42.000Z","dependencies_parsed_at":"2023-05-22T08:45:09.166Z","dependency_job_id":null,"html_url":"https://github.com/zjhellofss/lysql","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/zjhellofss%2Flysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjhellofss%2Flysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjhellofss%2Flysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjhellofss%2Flysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zjhellofss","download_url":"https://codeload.github.com/zjhellofss/lysql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239933067,"owners_count":19720728,"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":[],"created_at":"2024-11-08T11:54:35.376Z","updated_at":"2026-03-19T08:30:13.111Z","avatar_url":"https://github.com/zjhellofss.png","language":"C++","readme":"# 基于MySQL的日志采集系统\n\n## 对MySql API的封装 \n屏蔽了原生MySQL API繁杂的操作，加快了开发后续的日志采集系统的速度。\n\n## 连接数据库的操作\n```c++\n    Lysql::Lysql lysql;\n    lysql.init();\n    lysql.setConnectTimeout(5);\n    lysql.connect(\"127.0.0.1\", \"root\", \"xxxxyyyyy\", \"mydb\", 3306, 0);\n\n```\n\n## 建表操作\n\n```c++\nstring sql = \"CREATE TABLE IF NOT EXISTS `t_data`  (\\\n\t\t`id` int AUTO_INCREMENT,\\\n\t\t`name` varchar(1024),\\\n\t\t`size` int,\\\n        `data` blob,\\\n\t\tPRIMARY KEY(`id`)\\\n\t\t) ENGINE =InnoDB\";\n\n    ResultData resultData1;\n    resultData1.loadFile(\"../Lysql.cpp\");\n```\n\n\n## 插入操作\n\n```c++\n ResultData r2(\u0026resultData1.size);\n    std::map\u003cstd::string, ResultData\u003e resultData;\n    resultData.insert({\"name\", \"Lyxxsql.h\"});\n    resultData.insert({\"size\", r2});\n    resultData.insert({\"data\", resultData1.data});\n```\n\n## update操作\n\n```c++\n    //r为update操作中受影响的条目\n    int r = lysql.updateBin(resultData, \"t_data\", \"id=14\");\n```\n\n## 事务操作\n\n```c++\n    lysql.startTransaction();\n    lysql.stopTransaction();\n    lysql.commit();\n```\n\n## 日志审计系统 \n基于这个库写出了一套日志收集和审计系统，对Linux系统中符合策略的日志进行录入和读取,并最后供用户查看。\u003cbr/\u003e日志收集的过程不需要人为参与均为自动是自动进行的。\n只需要将agent和center部署在服务端，将client部署在客户端，在登录之后就可以对审计的结果进行查看。\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjhellofss%2Flysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzjhellofss%2Flysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjhellofss%2Flysql/lists"}