{"id":15178885,"url":"https://github.com/jidancong/geo","last_synced_at":"2026-02-26T21:44:40.957Z","repository":{"id":188836068,"uuid":"679515279","full_name":"jidancong/geo","owner":"jidancong","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-21T07:07:20.000Z","size":53806,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T19:24:20.388Z","etag":null,"topics":["fluent-bit","geo","geoip","geoip2","geomap","grafana","ip2location"],"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/jidancong.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,"publiccode":null,"codemeta":null}},"created_at":"2023-08-17T02:53:38.000Z","updated_at":"2023-08-17T03:39:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4b873a7-2f66-4414-9e5d-62869d52051d","html_url":"https://github.com/jidancong/geo","commit_stats":null,"previous_names":["jidancong/geo"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jidancong/geo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jidancong%2Fgeo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jidancong%2Fgeo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jidancong%2Fgeo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jidancong%2Fgeo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jidancong","download_url":"https://codeload.github.com/jidancong/geo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jidancong%2Fgeo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29873574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T21:05:00.265Z","status":"ssl_error","status_checked_at":"2026-02-26T20:57:13.669Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["fluent-bit","geo","geoip","geoip2","geomap","grafana","ip2location"],"created_at":"2024-09-27T15:41:05.983Z","updated_at":"2026-02-26T21:44:40.936Z","avatar_url":"https://github.com/jidancong.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geo\n\u003e 收集nginx日志信息，对日志信息**IP地址**过滤分析\n\n## Flow\n```text\n                                                                +------------------------+\n                        +--------+                              |                        |\n+-----------+           |        |          +----------+        |                        |\n|fluent-bit |----------\u003e| kafka  |\u003c---------|  golang  |-------\u003e|     elasticsearch      |\n+-----------+           |        |          +----------+        |                        |\n                        +--------+                              |                        |\n                                                                +------------------------+\n```\n\n## 入门开始\n\n### Nginx日志输出配置\n```nginx\nhttp {\n        # Logging Settings\n        log_format main   '{\"@timestamp\":\"$time_iso8601\",'\n                        '\"@source\":\"$server_addr\",'\n                        '\"hostname\":\"$hostname\",'\n                        '\"ip\":\"$http_x_forwarded_for\",'\n                        '\"client\":\"$remote_addr\",'\n                        '\"request_method\":\"$request_method\",'\n                        '\"scheme\":\"$scheme\",'\n                        '\"domain\":\"$server_name\",'\n                        '\"referer\":\"$http_referer\",'\n                        '\"request\":\"$request_uri\",'\n                        '\"args\":\"$args\",'\n                        '\"size\":$body_bytes_sent,'\n                        '\"status\": $status,'\n                        '\"responsetime\":$request_time,'\n                        '\"upstreamtime\":\"$upstream_response_time\",'\n                        '\"upstreamaddr\":\"$upstream_addr\",'\n                        '\"http_user_agent\":\"$http_user_agent\",'\n                        '\"https\":\"$https\"'\n                        '}';\n\n        access_log /var/log/nginx/access.log main;\n        error_log /var/log/nginx/error.log;\n}\n```\n\n### Fluent-bit配置\n```ini\n[INPUT]\n    name              tail\n    path              /var/log/nginx/*.log\n    DB                /fluent-bit/etc/fluent-bit.db\n    Mem_Buf_Limit     5MB\n    Skip_Long_Lines   On\n    Refresh_Interval  10\n    Parser            json\n\n[OUTPUT]\n    Name        kafka\n    Match       *\n    Brokers     192.168.52.172:9092\n    Topics      nginx-log\n```\n\n### 安装和运行\n\n```bash\n./geo\n```\n\n#### 配置说明\n\n```yaml\nkafka:\n  host: \"kafka:9092\"                        # kafka服务器ip，多个kafka以逗号隔开 例如：\"kafka1:9092,kafka2:9092,kafka3:9092\"\n  topic: \"nginx-log\"                        # 消费topic\n  groupId: \"1\"                              # kafka groupid\n  numPartitions: 3                          # 自动创建kafka分区数量\n  replication: -1                           # 自动创建kafka副本数量\nes:\n  host: http://es:9200                      # es地址\n  preName: logstash-                        # es文档前缀\n\nchunzhen:                          \n  path: config/qqwry.dat                    # 纯真离线库路径\nip2location:\n  path: config/IP2LOCATION-LITE-DB11.BIN    # ip2location离线数据库路径\n```\n\n## 源码安装\n```bash\ngo mod download\ngo build\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjidancong%2Fgeo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjidancong%2Fgeo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjidancong%2Fgeo/lists"}