{"id":27118407,"url":"https://github.com/suconghou/nginx_log","last_synced_at":"2025-10-06T00:32:57.361Z","repository":{"id":70470990,"uuid":"584409913","full_name":"suconghou/nginx_log","owner":"suconghou","description":"nginx access log parse tool","archived":false,"fork":false,"pushed_at":"2025-03-17T09:12:57.000Z","size":86,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-17T10:28:56.734Z","etag":null,"topics":["access-logs","apache-log","logparser","nginx","nginx-log","nim"],"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/suconghou.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-01-02T13:42:58.000Z","updated_at":"2025-03-17T09:13:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"31e83b23-6913-4c1b-a679-6939a5981e7d","html_url":"https://github.com/suconghou/nginx_log","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suconghou%2Fnginx_log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suconghou%2Fnginx_log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suconghou%2Fnginx_log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suconghou%2Fnginx_log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suconghou","download_url":"https://codeload.github.com/suconghou/nginx_log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615474,"owners_count":20967183,"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":["access-logs","apache-log","logparser","nginx","nginx-log","nim"],"created_at":"2025-04-07T07:57:45.166Z","updated_at":"2025-10-06T00:32:52.329Z","avatar_url":"https://github.com/suconghou.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## nim 版本\n\n```\nnim --mm:orc --threads:off --passC:-flto --passL:-flto -d:release --passL:-s --passL:-static --opt:speed c main\nnim --mm:arc --threads:off --passC:-flto --passL:-flto -d:release --passL:-s --passL:-static --opt:speed c main\n```\n\nnim 使用 orc, arc 相比其他gc算法速度更快\n\n注意本地测试时也要threads:off,编译出来的性能略有提升\n\n```\nnim --threads:off --mm:arc -d:release --opt:speed c main.nim\n```\n\n\n## c 版本\n\n```\ngcc -Wall -std=c17 -flto=auto -static-libstdc++ -static-libgcc --static -Wl,-Bstatic,--gc-sections -O3 -ffunction-sections -fdata-sections main.c -o ngx_log\n```\n\n\n## c++ 版本\n\n```\ng++ -Wall -std=c++20 -flto=auto -static-libstdc++ -static-libgcc --static -Wl,-Bstatic,--gc-sections -O3 -ffunction-sections -fdata-sections main.cpp -o ngx_log\n\n```\n\n分析格式为nginx默认配置格式\n```\n    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\n                      '$status $body_bytes_sent \"$http_referer\" '\n                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n\n```\n\n非正则匹配，是基于字符分析的匹配，再此格式上后面补充也可正常分析\n\nc版本速度最快，内存占用也最小，nim与c++版本速度相当，比c版本慢40%\n\n测试数据700MB+, 约200万行\n\n| 版本  | 时间  |\n| ------ | ------   |\n| c     | 1.932s    |\n| c++   | 6.086s    |\n| nim   | 5.698s    |\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuconghou%2Fnginx_log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuconghou%2Fnginx_log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuconghou%2Fnginx_log/lists"}