{"id":16366652,"url":"https://github.com/centminmod/cf-analytics","last_synced_at":"2025-03-23T02:32:38.877Z","repository":{"id":80279730,"uuid":"186731050","full_name":"centminmod/cf-analytics","owner":"centminmod","description":"Cloudflare Zone Analytics API Script - query your zone's Analytics stats via Cloudflare API","archived":false,"fork":false,"pushed_at":"2024-10-23T13:02:39.000Z","size":56,"stargazers_count":22,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T16:52:57.744Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/centminmod.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":"2019-05-15T01:59:24.000Z","updated_at":"2025-01-29T15:26:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa46c69f-6fb1-4f94-b8b9-0664174bb2bc","html_url":"https://github.com/centminmod/cf-analytics","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/centminmod%2Fcf-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centminmod%2Fcf-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centminmod%2Fcf-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centminmod%2Fcf-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/centminmod","download_url":"https://codeload.github.com/centminmod/cf-analytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245047977,"owners_count":20552430,"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-10-11T02:47:09.761Z","updated_at":"2025-03-23T02:32:38.857Z","avatar_url":"https://github.com/centminmod.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare Zone Analytics API Script (GraphQL)\n\nThis Cloudflare Zone Analytics API script, `cf-analytics-graphql.sh` uses the new Cloudflare GraphQL API as the old zone analytics API has been deprecated and supports both traditional Cloudflare Global API Token authentication (`CF_GLOBAL_TOKEN='y'`) and newer non-global Cloudflare permission based API Token authentication (`CF_GLOBAL_TOKEN='n'`) which is currently in beta testing. The `cf-analytics-graphql.sh` script is currently default to `CF_GLOBAL_TOKEN='n'` for Cloudflare API Token based authentication.\n\nIf you have Cloudflare Argo enabled on your CF zone, also set `CF_ARGO='y'` - currently enabled by default for testing purposes.\n\n## Required Cloudflare API Token Permissions\n\nBy default the `cf-analytics-graphql.sh` script sets `CF_GLOBAL_TOKEN='n'` to use Cloudflare API Token. If you intend to use Cloudflare API Token, you'll need the **Account** and **Zone** level permissions for `Logs:Read` and **Zone** level permissions for `Analytics:Read` generated at [https://dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens).\n\n## Usage\n\nPopulate your SSH session variables Where `YOUR_CLOUDFLARE_API_KEY` can either be your Cloudflare Global API Token or your generated Cloudflare API Token.\n\n### Sessions variables\n\n```\nexport zid=YOUR_CLOUDFLARE_DOMAIN_ZONE_ID\nexport cfkey=YOUR_CLOUDFLARE_API_KEY\nexport cfemail=YOUR_CLOUDFLARE_ACCOUNT_EMAIL\n```\n\n### Settings file\n\nOr create a settings file `cf-analytics-graphql.ini` in same directory as `cf-analytics-graphql.sh` and populate your Cloudflare related variables within `cf-analytics-graphql.ini` with the following. Then you'll be able to run `cf-analytics-graphql.sh`.\n\n```\nzid=YOUR_CLOUDFLARE_DOMAIN_ZONE_ID\ncfkey=YOUR_CLOUDFLARE_API_KEY\ncfemail=YOUR_CLOUDFLARE_ACCOUNT_EMAIL\n```\n\nYou can populate the settings file `cf-analytics-graphql.ini` with other overriding variables too:\n\nIf you have Cloudflare Argo enabled, you may want to also get Argo analytic stats\n\n```\nCF_ARGO='y'\nzid=YOUR_CLOUDFLARE_DOMAIN_ZONE_ID\ncfkey=YOUR_CLOUDFLARE_API_KEY\ncfemail=YOUR_CLOUDFLARE_ACCOUNT_EMAIL\n```\n\nIf you on Cloudflare Enterprise plan and enabled Enterprise Bot Management, you can enable additional stats for Bot Management score (`botScore`) and bot sore (`botScoreSrcName`) etc:\n\n```\nCF_ENTERPRISE='y'\nzid=YOUR_CLOUDFLARE_DOMAIN_ZONE_ID\ncfkey=YOUR_CLOUDFLARE_API_KEY\ncfemail=YOUR_CLOUDFLARE_ACCOUNT_EMAIL\n```\n\nIf you have Cloudflare Argo + Enterprise Botmanagement enabled:\n\n```\nCF_ARGO='y'\nCF_ENTERPRISE='y'\nzid=YOUR_CLOUDFLARE_DOMAIN_ZONE_ID\ncfkey=YOUR_CLOUDFLARE_API_KEY\ncfemail=YOUR_CLOUDFLARE_ACCOUNT_EMAIL\n```\n\nSwitch from default Cloudflare API Token authentication to using Cloudflare Global API Key and Cloudflare Account Email\n\n```\nCF_GLOBAL_TOKEN='y'\nzid=YOUR_CLOUDFLARE_DOMAIN_ZONE_ID\ncfkey=YOUR_CLOUDFLARE_GLOBAL_API_KEY\ncfemail=YOUR_CLOUDFLARE_ACCOUNT_EMAIL\n```\n\nSave JSON log output\n\n```\nJSON_OUTPUT_SAVE='y'\nCF_GLOBAL_TOKEN='y'\nzid=YOUR_CLOUDFLARE_DOMAIN_ZONE_ID\ncfkey=YOUR_CLOUDFLARE_GLOBAL_API_KEY\ncfemail=YOUR_CLOUDFLARE_ACCOUNT_EMAIL\n```\n\nThe output would show something like:\n\n```\nJSON log saved: /home/cf-graphql-json-output/cf-graphql-ip.json\n```\n\nSave JSON log output and JSON to CSV converted log output\n\n```\nJSON_TO_CSV='y'\nJSON_OUTPUT_SAVE='y'\nCF_GLOBAL_TOKEN='y'\nzid=YOUR_CLOUDFLARE_DOMAIN_ZONE_ID\ncfkey=YOUR_CLOUDFLARE_GLOBAL_API_KEY\ncfemail=YOUR_CLOUDFLARE_ACCOUNT_EMAIL\n```\n\nThe output would show something like:\n\n```\nJSON log saved: /home/cf-graphql-json-output/cf-graphql-ip.json\nCSV converted log saved: /home/cf-graphql-json-output/cf-graphql-ip.csv\n```\n\nSupported options include querying the Cloudflare Firewall GraphQL API filtering by ruleId, rayID and client visitor IP address.\n\n```\n./cf-analytics-graphql.sh\n\n\nUsage:\n\n---------------------------------------------\nZone Analytics\n---------------------------------------------\n./cf-analytics-graphql.sh hrs 72\n./cf-analytics-graphql.sh days 3\n\n---------------------------------------------\nFirewall Events\n---------------------------------------------\n./cf-analytics-graphql.sh ruleid-mins 60 cfruleid\n./cf-analytics-graphql.sh ruleid-hrs 72 cfruleid\n./cf-analytics-graphql.sh ruleid-days 3 cfruleid\n./cf-analytics-graphql.sh rayid-mins 60 cfrayid\n./cf-analytics-graphql.sh rayid-hrs 72 cfrayid\n./cf-analytics-graphql.sh rayid-days 3 cfrayid\n./cf-analytics-graphql.sh ip-mins 60 request-ip|all\n./cf-analytics-graphql.sh ip-hrs 72 request-ip|all\n./cf-analytics-graphql.sh ip-days 3 request-ip|all\n\n---------------------------------------------\nFirewall Events filter by action\n---------------------------------------------\n./cf-analytics-graphql.sh ruleid-mins 60 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow}\n./cf-analytics-graphql.sh ruleid-hrs 72 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow}\n./cf-analytics-graphql.sh ruleid-days 3 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow}\n./cf-analytics-graphql.sh rayid-mins 60 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow}\n./cf-analytics-graphql.sh rayid-hrs 72 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow}\n./cf-analytics-graphql.sh rayid-days 3 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow}\n./cf-analytics-graphql.sh ip-mins 60 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow}\n./cf-analytics-graphql.sh ip-hrs 72 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow}\n./cf-analytics-graphql.sh ip-days 3 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow}\n\n---------------------------------------------\nFirewall Events filter by action + limit XX\n---------------------------------------------\n./cf-analytics-graphql.sh ruleid-mins 60 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100\n./cf-analytics-graphql.sh ruleid-hrs 72 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100\n./cf-analytics-graphql.sh ruleid-days 3 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100\n./cf-analytics-graphql.sh rayid-mins 60 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100\n./cf-analytics-graphql.sh rayid-hrs 72 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100\n./cf-analytics-graphql.sh rayid-days 3 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100\n./cf-analytics-graphql.sh ip-mins 60 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100\n./cf-analytics-graphql.sh ip-hrs 72 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100\n./cf-analytics-graphql.sh ip-days 3 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100\n\n---------------------------------------------\nFirewall Events filter by action + limit XX + hostname\n---------------------------------------------\n./cf-analytics-graphql.sh ruleid-mins 60 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname\n./cf-analytics-graphql.sh ruleid-hrs 72 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname\n./cf-analytics-graphql.sh ruleid-days 3 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname\n./cf-analytics-graphql.sh rayid-mins 60 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname\n./cf-analytics-graphql.sh rayid-hrs 72 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname\n./cf-analytics-graphql.sh rayid-days 3 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname\n./cf-analytics-graphql.sh ip-mins 60 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname\n./cf-analytics-graphql.sh ip-hrs 72 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname\n./cf-analytics-graphql.sh ip-days 3 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname\n\n---------------------------------------------\nFirewall Events filter by action + limit XX + hostname + referrer\n---------------------------------------------\n./cf-analytics-graphql.sh ruleid-mins 60 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname|none referrer|none|empty|notempty\n./cf-analytics-graphql.sh ruleid-hrs 72 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname|none referrer|none|empty|notempty\n./cf-analytics-graphql.sh ruleid-days 3 cfruleid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname|none referrer|none|empty|notempty\n./cf-analytics-graphql.sh rayid-mins 60 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname|none referrer|none|empty|notempty\n./cf-analytics-graphql.sh rayid-hrs 72 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname|none referrer|none|empty|notempty\n./cf-analytics-graphql.sh rayid-days 3 cfrayid {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname|none referrer|none|empty|notempty\n./cf-analytics-graphql.sh ip-mins 60 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname|none referrer|none|empty|notempty\n./cf-analytics-graphql.sh ip-hrs 72 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname|none referrer|none|empty|notempty\n./cf-analytics-graphql.sh ip-days 3 request-ip|all {block|log|challenge|challenge_solved|managed_block|managed_challenge|jschallenge|allow} 100 hostname|none referrer|none|empty|notempty\n```\n\n## Example Web Analytics For Past 72hrs\n\nExample web traffic analytics for Cloudflare Zone site where Cloudflare Argo is enabled and thus `CF_ARGO='y' is set in script.\n\n```\n./cf-analytics-graphql.sh hrs 72\n\n\n\n{ \"query\":\n    \"query {\n      viewer {\n        zones(filter: {zoneTag: $zoneTag}) {\n          httpRequests1hGroups(\n            limit: $limit,\n            filter: $filter,\n          ) {\n            sum {\n              browserMap {\n                pageViews\n                uaBrowserFamily\n              }\n              bytes\n              cachedBytes\n              cachedRequests\n              contentTypeMap {\n                bytes\n                requests\n                edgeResponseContentTypeName\n              }\n              clientHTTPVersionMap {\n                clientHTTPProtocol\n                requests\n              }\n              clientSSLMap {\n                requests\n                clientSSLProtocol\n              }\n              countryMap {\n                bytes\n                requests\n                threats\n                clientCountryName\n              }\n              encryptedBytes\n              encryptedRequests\n              ipClassMap {\n                requests\n                ipType\n              }\n              pageViews\n              requests\n              responseStatusMap {\n                requests\n                edgeResponseStatus\n              }\n              threats\n              threatPathingMap {\n                requests\n                threatPathingName\n              }\n            }\n            uniq {\n              uniques\n            }\n          }\n        }\n      }\n    }\",\n  \n    \"variables\": {\n      \"zoneTag\": \"zoneid\",\n      \"limit\": 10000,\n      \"filter\": {\n        \"datetime_geq\": \"2021-03-27T09:26:14Z\",\n        \"datetime_leq\": \"2021-03-30T09:26:14Z\"\n      }\n    }\n  }\n\n------------------------------------------------------------------\nCloudflare Argo Analytics\n------------------------------------------------------------------\n  since: 2021-03-28T09:25:00Z\n  until: 2021-03-30T09:25:00Z\n------------------------------------------------------------------\nArgo Response Time:\n------------------------------------------------------------------\nrequest-without-argo: 19535\nrequest-with-argo: 177170\nargo-smarted-routed: 69%\nargo-improvement: 63.9700%\n  without-argo: 505 (milliseconds)\n  with-argo 182 (milliseconds)\n------------------------------------------------------------------\nArgo Cloudflare Datacenter Response Times\n------------------------------------------------------------------\n  SIN  29928  66.35914740653341   926.361061419201    311.63575915530606\n  SCL  29037  64.11976911817536   568.6848635235732   204.04544202224747\n  MEL  26015  62.50412858804896   816.4853044086774   306.1482798385547\n  AMS  8267   57.09213687101159   321.40695067264573  137.90885448167413\n  DFW  7366   64.41476705708077   345.3693528693529   122.90048873201195\n  FRA  6951   63.84892040657324   275.80409356725147  99.70615738742627\n  LHR  6918   59.93690301038376   224.18741355463348  89.81642093090488\n  ATL  6879   62.76396415442681   284.34              105.87694432330281\n  MXP  6875   45.72770180212848   84.16883963494134   45.68036363636364\n  MIA  6872   54.16696837456991   110.22667542706965  50.52022700814901\n  PRG  6867   55.690435837799825  91.20322580645161   40.41175185670598\n  CDG  6864   35.4306049437425    45.15862944162436   29.158653846153847\n  LAX  6847   66.75273582985896   246.56369426751593  81.9756827807799\n  SJC  6827   66.2770115194605    463.4505208333333   156.2893657536253\n  SYD  6814   68.00495069273235   846.3161764705883   270.77927795714703\n  IAD  6805   24.665475866227325  35.37247474747475   26.647685525349008\n  ARN  642    59.229363786066536  625.4310344827586   254.99221183800623\n  MAD  423    58.42195555004257   537.8389830508474   223.6229314420804\ntotal-argo-reqs: 177197\ndatacenter-calc-avg-resp-without: 507.1424\ndatacenter-calc-avg-resp-with: 182.5987\nargo-improvement:\n    min: 24.6655\n    avg: 57.5226\n    max: 68.0050\n    stddev: 11.5409\nargo-resp-time-without-argo:\n    min: 35.3725\n    avg: 380.4650\n    max: 926.3611\n    stddev: 284.4499\nargo-resp-time-with-argo:\n    min: 26.6477\n    avg: 142.1176\n    max: 311.6358\n    stddev: 96.8914\n\n------------------------------------------------------------------\nCloudflare Zone Analytics\n------------------------------------------------------------------\nsince: 2021-03-27T09:26:14Z\nuntil: 2021-03-30T09:26:14Z\n------------------------------------------------------------------\nRequests:\n------------------------------------------------------------------\nnon-cached-requests:  323848\ncached-requests:      452713\ntotal-requests:       776561\nencrypted-requests:   744993\n\n------------------------------------------------------------------\nPageviews:\n------------------------------------------------------------------\n383197\n\n------------------------------------------------------------------\nRequests HTTP Status Codes:\n------------------------------------------------------------------\n101:  11\n200:  665556\n201:  5\n204:  20645\n206:  9\n301:  5178\n302:  10006\n303:  274\n304:  6453\n307:  11344\n308:  8\n400:  13\n401:  1\n403:  49432\n404:  5570\n405:  24\n409:  27\n416:  32\n499:  1801\n500:  7\n503:  11\n520:  134\n521:  14\n524:  6\n\n------------------------------------------------------------------\nRequests HTTP Versions:\n------------------------------------------------------------------\nHTTP/1.0:  26712\nHTTP/1.1:  428006\nHTTP/2:    245951\nHTTP/3:    75892\n\n------------------------------------------------------------------\nRequests SSL Protocols:\n------------------------------------------------------------------\nnone:     31568\nTLSv1.2:  122015\nTLSv1.3:  622978\n\n------------------------------------------------------------------\nRequests Content Types:\n------------------------------------------------------------------\nhtml:     459383  bytes:  20494621328\njs:       127196  bytes:  1412620506\npng:      60180   bytes:  292665356\nempty:    31516   bytes:  12842897\ncss:      29641   bytes:  280338412\nwebp:     25491   bytes:  222653641\nwoff:     13967   bytes:  851518637\njson:     10031   bytes:  13483492\ntxt:      5765    bytes:  14734200\nxml:      4461    bytes:  59048229\nico:      3593    bytes:  4404109\njs:       2391    bytes:  23764243\njpeg:     1335    bytes:  19159073\nbin:      930     bytes:  1317517253\ngif:      342     bytes:  22968741\nunknown:  183     bytes:  36692272\nrss:      43      bytes:  4870403\neot:      38      bytes:  4003776\nttf:      36      bytes:  4945194\nxml:      25      bytes:  9227113\nsvg:      8       bytes:  3121478\nzip:      6       bytes:  111969\n\n------------------------------------------------------------------\nRequests IP Class:\n------------------------------------------------------------------\nunknown:            176706\nbadHost:            1593\nsearchEngine:       127174\nallowlist:          333\nmonitoringService:  12234\nnoRecord:           457907\ntor:                614\n\n------------------------------------------------------------------\nRequests Country Top 50:\n------------------------------------------------------------------\nUS:  319791  threats:  9982  bytes:  7766722228\nAU:  54805   threats:  870   bytes:  1137255376\nDE:  44106   threats:  4545  bytes:  1775162169\nNL:  42078   threats:  7486  bytes:  2856619221\nFR:  40743   threats:  4905  bytes:  1750683099\nGB:  38951   threats:  3372  bytes:  1495543935\nIN:  21923   threats:  207   bytes:  477654529\nSG:  19866   threats:  1488  bytes:  1119673003\nJP:  16690   threats:  70    bytes:  379603356\nIT:  15428   threats:  112   bytes:  91506265\nRU:  14421   threats:  1216  bytes:  636223533\nCN:  13501   threats:  449   bytes:  350017187\nCZ:  12850   threats:  18    bytes:  41797999\nCA:  11252   threats:  1661  bytes:  633472854\nVN:  7123    threats:  809   bytes:  288185237\nID:  7098    threats:  603   bytes:  231629020\nUA:  6613    threats:  3623  bytes:  1038477251\nBR:  6525    threats:  258   bytes:  125749928\nES:  5800    threats:  777   bytes:  291560069\nIL:  4615    threats:  19    bytes:  85188456\nPL:  4517    threats:  46    bytes:  63677688\nKR:  4425    threats:  1056  bytes:  326642777\nHK:  3891    threats:  44    bytes:  152155967\nTR:  2429    threats:  38    bytes:  66302068\nCL:  2365    threats:  14    bytes:  306968910\nBG:  2241    threats:  540   bytes:  165048553\nTH:  2236    threats:  391   bytes:  129354213\nTW:  2218    threats:  68    bytes:  44067860\nEC:  2140    threats:  22    bytes:  16520043\nRO:  2111    threats:  90    bytes:  35253314\nSE:  1895    threats:  32    bytes:  44182202\nPH:  1864    threats:  19    bytes:  21147520\nFI:  1828    threats:  83    bytes:  25863731\nGR:  1818    threats:  13    bytes:  15896350\nNO:  1764    threats:  1     bytes:  23079302\nMY:  1749    threats:  21    bytes:  23324092\nPT:  1745    threats:  6     bytes:  20028038\nMX:  1619    threats:  407   bytes:  123074157\nIE:  1519    threats:  168   bytes:  47492847\nPK:  1413    threats:  129   bytes:  47516020\nCH:  1229    threats:  65    bytes:  28712086\nAT:  1167    threats:  10    bytes:  21705223\nXX:  1149    threats:  53    bytes:  52165989\nAR:  1140    threats:  29    bytes:  21405448\nIR:  1104    threats:  187   bytes:  61209609\nHU:  1088    threats:  25    bytes:  16885023\nCO:  875     threats:  25    bytes:  15074114\nEG:  858     threats:  6     bytes:  10241328\nSK:  844     threats:  7     bytes:  12676860\nRS:  715     threats:  15    bytes:  9074126\n\n\n------------------------------------------------------------------\nBandwidth Country Top 50:\n------------------------------------------------------------------\nUS:  319791  threats:  9982  bytes:  7766722228\nNL:  42078   threats:  7486  bytes:  2856619221\nDE:  44106   threats:  4545  bytes:  1775162169\nFR:  40743   threats:  4905  bytes:  1750683099\nGB:  38951   threats:  3372  bytes:  1495543935\nAU:  54805   threats:  870   bytes:  1137255376\nSG:  19866   threats:  1488  bytes:  1119673003\nUA:  6613    threats:  3623  bytes:  1038477251\nRU:  14421   threats:  1216  bytes:  636223533\nCA:  11252   threats:  1661  bytes:  633472854\nIN:  21923   threats:  207   bytes:  477654529\nJP:  16690   threats:  70    bytes:  379603356\nCN:  13501   threats:  449   bytes:  350017187\nKR:  4425    threats:  1056  bytes:  326642777\nCL:  2365    threats:  14    bytes:  306968910\nES:  5800    threats:  777   bytes:  291560069\nVN:  7123    threats:  809   bytes:  288185237\nID:  7098    threats:  603   bytes:  231629020\nBG:  2241    threats:  540   bytes:  165048553\nHK:  3891    threats:  44    bytes:  152155967\nTH:  2236    threats:  391   bytes:  129354213\nBR:  6525    threats:  258   bytes:  125749928\nMX:  1619    threats:  407   bytes:  123074157\nIT:  15428   threats:  112   bytes:  91506265\nIL:  4615    threats:  19    bytes:  85188456\nLT:  646     threats:  280   bytes:  82788092\nTR:  2429    threats:  38    bytes:  66302068\nPL:  4517    threats:  46    bytes:  63677688\nIR:  1104    threats:  187   bytes:  61209609\nAD:  193     threats:  193   bytes:  52355696\nXX:  1149    threats:  53    bytes:  52165989\nPK:  1413    threats:  129   bytes:  47516020\nIE:  1519    threats:  168   bytes:  47492847\nKE:  361     threats:  159   bytes:  45132590\nSE:  1895    threats:  32    bytes:  44182202\nTW:  2218    threats:  68    bytes:  44067860\nCZ:  12850   threats:  18    bytes:  41797999\nT1:  614     threats:  579   bytes:  38929925\nRO:  2111    threats:  90    bytes:  35253314\nCH:  1229    threats:  65    bytes:  28712086\nFI:  1828    threats:  83    bytes:  25863731\nBD:  666     threats:  128   bytes:  25474902\nSC:  31      threats:  1     bytes:  24413207\nNZ:  554     threats:  66    bytes:  23532949\nMY:  1749    threats:  21    bytes:  23324092\nKH:  190     threats:  81    bytes:  23202908\nNO:  1764    threats:  1     bytes:  23079302\nAT:  1167    threats:  10    bytes:  21705223\nAR:  1140    threats:  29    bytes:  21405448\nPH:  1864    threats:  19    bytes:  21147520\n\n------------------------------------------------------------------\nThreats Country Top 50:\n------------------------------------------------------------------\nUS:  319791  threats:  9982  bytes:  7766722228\nNL:  42078   threats:  7486  bytes:  2856619221\nFR:  40743   threats:  4905  bytes:  1750683099\nDE:  44106   threats:  4545  bytes:  1775162169\nUA:  6613    threats:  3623  bytes:  1038477251\nGB:  38951   threats:  3372  bytes:  1495543935\nCA:  11252   threats:  1661  bytes:  633472854\nSG:  19866   threats:  1488  bytes:  1119673003\nRU:  14421   threats:  1216  bytes:  636223533\nKR:  4425    threats:  1056  bytes:  326642777\nAU:  54805   threats:  870   bytes:  1137255376\nVN:  7123    threats:  809   bytes:  288185237\nES:  5800    threats:  777   bytes:  291560069\nID:  7098    threats:  603   bytes:  231629020\nT1:  614     threats:  579   bytes:  38929925\nBG:  2241    threats:  540   bytes:  165048553\nCN:  13501   threats:  449   bytes:  350017187\nMX:  1619    threats:  407   bytes:  123074157\nTH:  2236    threats:  391   bytes:  129354213\nLT:  646     threats:  280   bytes:  82788092\nBR:  6525    threats:  258   bytes:  125749928\nIN:  21923   threats:  207   bytes:  477654529\nAD:  193     threats:  193   bytes:  52355696\nIR:  1104    threats:  187   bytes:  61209609\nIE:  1519    threats:  168   bytes:  47492847\nKE:  361     threats:  159   bytes:  45132590\nPK:  1413    threats:  129   bytes:  47516020\nBD:  666     threats:  128   bytes:  25474902\nIT:  15428   threats:  112   bytes:  91506265\nRO:  2111    threats:  90    bytes:  35253314\nFI:  1828    threats:  83    bytes:  25863731\nKH:  190     threats:  81    bytes:  23202908\nAM:  213     threats:  71    bytes:  18899888\nJP:  16690   threats:  70    bytes:  379603356\nTW:  2218    threats:  68    bytes:  44067860\nNZ:  554     threats:  66    bytes:  23532949\nCH:  1229    threats:  65    bytes:  28712086\nXX:  1149    threats:  53    bytes:  52165989\nPL:  4517    threats:  46    bytes:  63677688\nHK:  3891    threats:  44    bytes:  152155967\nTR:  2429    threats:  38    bytes:  66302068\nSE:  1895    threats:  32    bytes:  44182202\nAR:  1140    threats:  29    bytes:  21405448\nZA:  641     threats:  26    bytes:  13656693\nHU:  1088    threats:  25    bytes:  16885023\nCO:  875     threats:  25    bytes:  15074114\nSA:  407     threats:  22    bytes:  5338196\nEC:  2140    threats:  22    bytes:  16520043\nMY:  1749    threats:  21    bytes:  23324092\nAL:  313     threats:  21    bytes:  4214500\n\n------------------------------------------------------------------\nThreats:\n------------------------------------------------------------------\nbic.ban.unknown: 49\nuser.ban.ip: 3\n```\n\n## Example Cloudflare Firewall GraphQL IP Address Filter\n\nQuerying the Cloudflare Firewall GraphQL API filtering by IP address `119.92.185.135` for past 24hrs for Firewall events with action = `block`\n\n```\n./cf-analytics-graphql.sh ip-hrs 24 119.92.185.135 block\n\n\n\n{ \"query\":\n    \"query {\n      viewer {\n        zones(filter: {zoneTag: $zoneTag}) {\n          firewallEventsAdaptiveGroups(\n            limit: $limit,\n            filter: $filter,\n            orderBy: [datetime_ASC]\n            ) {\n            dimensions {\n              action\n              botScore\n              botScoreSrcName\n              source\n              datetime\n              clientIP\n              clientAsn\n              clientCountryName\n              edgeColoName\n              clientRequestHTTPProtocol\n              clientRequestHTTPHost\n              clientRequestPath\n              clientRequestQuery\n              clientRequestScheme\n              clientRequestHTTPMethodName\n              clientRefererHost\n              clientRefererPath\n              clientRefererQuery\n              clientRefererScheme\n              edgeResponseStatus\n              clientASNDescription\n              userAgent\n              kind\n              originResponseStatus\n              ruleId\n              rayName\n            }\n          }\n        }\n      }\n    }\",\n  \n    \"variables\": {\n      \"zoneTag\": \"zoneid\",\n      \"limit\": 100,\n      \"filter\": {\n        \"clientIP\": \"119.92.185.135\",\n        \"action\": \"block\",\n        \n        \"datetime_geq\": \"2021-03-29T09:37:21Z\",\n        \"datetime_leq\": \"2021-03-30T09:37:21Z\"\n      }\n    }\n  }\n\n------------------------------------------------------------------\nCloudflare Firewall\n------------------------------------------------------------------\nsince: 2021-03-29T09:37:21Z\nuntil: 2021-03-30T09:37:21Z\n------------------------------------------------------------------\n1 Firewall Events for Request IP: 119.92.185.135\n------------------------------------------------------------------\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC GET HTTP/1.1 bd706145258349c686ddb32b94dxxxxx\n------------------------------------------------------------------\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC GET HTTP/1.1\n------------------------------------------------------------------\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC domain.com GET HTTP/1.1\n------------------------------------------------------------------\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC domain.com GET HTTP/1.1 /wp-login.php \n------------------------------------------------------------------\n119.92.185.135 637f925cbec96d7c 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC 2021-03-30T07:19:47Z domain.com GET HTTP/1.1 /wp-login.php \n------------------------------------------------------------------\n{\n  \"results\": [\n    {\n      \"action\": \"block\",\n      \"botScore\": 1,\n      \"botScoreSrcName\": \"Heuristics\",\n      \"clientASNDescription\": \"IPG-AS-AP Philippine Long Distance Telephone Company\",\n      \"clientAsn\": \"9299\",\n      \"clientCountryName\": \"PH\",\n      \"clientIP\": \"119.92.185.135\",\n      \"clientRefererHost\": \"\",\n      \"clientRefererPath\": \"\",\n      \"clientRefererQuery\": \"\",\n      \"clientRefererScheme\": \"unknown\",\n      \"clientRequestHTTPHost\": \"domain.com\",\n      \"clientRequestHTTPMethodName\": \"GET\",\n      \"clientRequestHTTPProtocol\": \"HTTP/1.1\",\n      \"clientRequestPath\": \"/wp-login.php\",\n      \"clientRequestQuery\": \"\",\n      \"clientRequestScheme\": \"https\",\n      \"datetime\": \"2021-03-30T07:19:47Z\",\n      \"edgeColoName\": \"SJC\",\n      \"edgeResponseStatus\": 403,\n      \"kind\": \"firewall\",\n      \"originResponseStatus\": 0,\n      \"rayName\": \"637f925cbec96d7c\",\n      \"ruleId\": \"bd706145258349c686ddb32b94dxxxxx\",\n      \"source\": \"firewallrules\",\n      \"userAgent\": \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\"\n    }\n  ]\n}\n```\n\n## Example Cloudflare Firewall GraphQL Multiple IP Addresses Filter\n\nQuerying the Cloudflare Firewall GraphQL API filtering multiple IP addresses in comma separated list on command line `119.92.185.135,92.97.221.160` for past 24hrs for Firewall events with action = `block`\n\n```\n./cf-analytics-graphql.sh ip-hrs 24 119.92.185.135,92.97.221.160 block\n\n\n\n{ \"query\":\n    \"query {\n      viewer {\n        zones(filter: {zoneTag: $zoneTag}) {\n          firewallEventsAdaptiveGroups(\n            limit: $limit,\n            filter: $filter,\n            orderBy: [datetime_ASC]\n            ) {\n            dimensions {\n              action\n              botScore\n              botScoreSrcName\n              source\n              datetime\n              clientIP\n              clientAsn\n              clientCountryName\n              edgeColoName\n              clientRequestHTTPProtocol\n              clientRequestHTTPHost\n              clientRequestPath\n              clientRequestQuery\n              clientRequestScheme\n              clientRequestHTTPMethodName\n              clientRefererHost\n              clientRefererPath\n              clientRefererQuery\n              clientRefererScheme\n              edgeResponseStatus\n              clientASNDescription\n              userAgent\n              kind\n              originResponseStatus\n              ruleId\n              rayName\n            }\n          }\n        }\n      }\n    }\",\n  \n    \"variables\": {\n      \"zoneTag\": \"zoneid\",\n      \"limit\": 100,\n      \"filter\": {\n        \"clientIP_in\": [\"119.92.185.135\",\"92.97.221.160\"],\n        \"action\": \"block\",\n        \n        \"datetime_geq\": \"2021-03-29T09:43:34Z\",\n        \"datetime_leq\": \"2021-03-30T09:43:34Z\"\n      }\n    }\n  }\n\n------------------------------------------------------------------\nCloudflare Firewall\n------------------------------------------------------------------\nsince: 2021-03-29T09:43:34Z\nuntil: 2021-03-30T09:43:34Z\n------------------------------------------------------------------\n2 Firewall Events for Request IP: \"119.92.185.135\",\"92.97.221.160\"\n------------------------------------------------------------------\n      1 92.97.221.160 403 2xMachine Learning block 5384 EMIRATES-INTERNET Emirates Internet AE AMS GET HTTP/1.1 bd706145258349c686ddb32b94dxxxxx\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC GET HTTP/1.1 bd706145258349c686ddb32b94dxxxxx\n------------------------------------------------------------------\n      1 92.97.221.160 403 2xMachine Learning block 5384 EMIRATES-INTERNET Emirates Internet AE AMS GET HTTP/1.1\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC GET HTTP/1.1\n------------------------------------------------------------------\n      1 92.97.221.160 403 2xMachine Learning block 5384 EMIRATES-INTERNET Emirates Internet AE AMS domain.com GET HTTP/1.1\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC domain.com GET HTTP/1.1\n------------------------------------------------------------------\n      1 92.97.221.160 403 2xMachine Learning block 5384 EMIRATES-INTERNET Emirates Internet AE AMS domain.com GET HTTP/1.1 /wp-login.php \n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC domain.com GET HTTP/1.1 /wp-login.php \n------------------------------------------------------------------\n92.97.221.160 637f7b964f7bc765 403 2xMachine Learning block 5384 EMIRATES-INTERNET Emirates Internet AE AMS 2021-03-30T07:04:15Z domain.com GET HTTP/1.1 /wp-login.php \n119.92.185.135 637f925cbec96d7c 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC 2021-03-30T07:19:47Z domain.com GET HTTP/1.1 /wp-login.php \n------------------------------------------------------------------\n{\n  \"results\": [\n    {\n      \"action\": \"block\",\n      \"botScore\": 2,\n      \"botScoreSrcName\": \"Machine Learning\",\n      \"clientASNDescription\": \"EMIRATES-INTERNET Emirates Internet\",\n      \"clientAsn\": \"5384\",\n      \"clientCountryName\": \"AE\",\n      \"clientIP\": \"92.97.221.160\",\n      \"clientRefererHost\": \"\",\n      \"clientRefererPath\": \"\",\n      \"clientRefererQuery\": \"\",\n      \"clientRefererScheme\": \"unknown\",\n      \"clientRequestHTTPHost\": \"domain.com\",\n      \"clientRequestHTTPMethodName\": \"GET\",\n      \"clientRequestHTTPProtocol\": \"HTTP/1.1\",\n      \"clientRequestPath\": \"/wp-login.php\",\n      \"clientRequestQuery\": \"\",\n      \"clientRequestScheme\": \"https\",\n      \"datetime\": \"2021-03-30T07:04:15Z\",\n      \"edgeColoName\": \"AMS\",\n      \"edgeResponseStatus\": 403,\n      \"kind\": \"firewall\",\n      \"originResponseStatus\": 0,\n      \"rayName\": \"637f7b964f7bc765\",\n      \"ruleId\": \"bd706145258349c686ddb32b94dxxxxx\",\n      \"source\": \"firewallrules\",\n      \"userAgent\": \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\"\n    },\n    {\n      \"action\": \"block\",\n      \"botScore\": 1,\n      \"botScoreSrcName\": \"Heuristics\",\n      \"clientASNDescription\": \"IPG-AS-AP Philippine Long Distance Telephone Company\",\n      \"clientAsn\": \"9299\",\n      \"clientCountryName\": \"PH\",\n      \"clientIP\": \"119.92.185.135\",\n      \"clientRefererHost\": \"\",\n      \"clientRefererPath\": \"\",\n      \"clientRefererQuery\": \"\",\n      \"clientRefererScheme\": \"unknown\",\n      \"clientRequestHTTPHost\": \"domain.com\",\n      \"clientRequestHTTPMethodName\": \"GET\",\n      \"clientRequestHTTPProtocol\": \"HTTP/1.1\",\n      \"clientRequestPath\": \"/wp-login.php\",\n      \"clientRequestQuery\": \"\",\n      \"clientRequestScheme\": \"https\",\n      \"datetime\": \"2021-03-30T07:19:47Z\",\n      \"edgeColoName\": \"SJC\",\n      \"edgeResponseStatus\": 403,\n      \"kind\": \"firewall\",\n      \"originResponseStatus\": 0,\n      \"rayName\": \"637f925cbec96d7c\",\n      \"ruleId\": \"bd706145258349c686ddb32b94dxxxxx\",\n      \"source\": \"firewallrules\",\n      \"userAgent\": \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\"\n    }\n  ]\n}\n```\n\n## Example Cloudflare Firewall GraphQL RayId Address Filter\n\nQuerying the Cloudflare Firewall GraphQL API filtering by RayId `637f925cbec96d7c` for past 24hrs for Firewall events with action = `block`\n\n```\n./cf-analytics-graphql.sh rayid-hrs 24 637f925cbec96d7c block\n\n\n\n{ \"query\":\n    \"query {\n      viewer {\n        zones(filter: {zoneTag: $zoneTag}) {\n          firewallEventsAdaptiveGroups(\n            limit: $limit,\n            filter: $filter,\n            orderBy: [datetime_ASC]\n            ) {\n            dimensions {\n              action\n              botScore\n              botScoreSrcName\n              source\n              datetime\n              clientIP\n              clientAsn\n              clientCountryName\n              edgeColoName\n              clientRequestHTTPProtocol\n              clientRequestHTTPHost\n              clientRequestPath\n              clientRequestQuery\n              clientRequestScheme\n              clientRequestHTTPMethodName\n              clientRefererHost\n              clientRefererPath\n              clientRefererQuery\n              clientRefererScheme\n              edgeResponseStatus\n              clientASNDescription\n              userAgent\n              kind\n              originResponseStatus\n              ruleId\n              rayName\n            }\n          }\n        }\n      }\n    }\",\n  \n    \"variables\": {\n      \"zoneTag\": \"zoneid\",\n      \"limit\": 100,\n      \"filter\": {\n        \"rayName\": \"637f925cbec96d7c\",\n        \"action\": \"block\",\n        \n        \"datetime_geq\": \"2021-03-29T09:40:25Z\",\n        \"datetime_leq\": \"2021-03-30T09:40:25Z\"\n      }\n    }\n  }\n\n------------------------------------------------------------------\nCloudflare Firewall\n------------------------------------------------------------------\nsince: 2021-03-29T09:40:25Z\nuntil: 2021-03-30T09:40:25Z\n------------------------------------------------------------------\n1 Firewall Events for CF RayID: 637f925cbec96d7c\n------------------------------------------------------------------\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC GET HTTP/1.1 bd706145258349c686ddb32b94dxxxxx\n------------------------------------------------------------------\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC GET HTTP/1.1\n------------------------------------------------------------------\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC domain.com GET HTTP/1.1\n------------------------------------------------------------------\n      1 119.92.185.135 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC domain.com GET HTTP/1.1 /wp-login.php \n------------------------------------------------------------------\n119.92.185.135 637f925cbec96d7c 403 1xHeuristics block 9299 IPG-AS-AP Philippine Long Distance Telephone Company PH SJC 2021-03-30T07:19:47Z domain.com GET HTTP/1.1 /wp-login.php \n------------------------------------------------------------------\n{\n  \"results\": [\n    {\n      \"action\": \"block\",\n      \"botScore\": 1,\n      \"botScoreSrcName\": \"Heuristics\",\n      \"clientASNDescription\": \"IPG-AS-AP Philippine Long Distance Telephone Company\",\n      \"clientAsn\": \"9299\",\n      \"clientCountryName\": \"PH\",\n      \"clientIP\": \"119.92.185.135\",\n      \"clientRefererHost\": \"\",\n      \"clientRefererPath\": \"\",\n      \"clientRefererQuery\": \"\",\n      \"clientRefererScheme\": \"unknown\",\n      \"clientRequestHTTPHost\": \"domain.com\",\n      \"clientRequestHTTPMethodName\": \"GET\",\n      \"clientRequestHTTPProtocol\": \"HTTP/1.1\",\n      \"clientRequestPath\": \"/wp-login.php\",\n      \"clientRequestQuery\": \"\",\n      \"clientRequestScheme\": \"https\",\n      \"datetime\": \"2021-03-30T07:19:47Z\",\n      \"edgeColoName\": \"SJC\",\n      \"edgeResponseStatus\": 403,\n      \"kind\": \"firewall\",\n      \"originResponseStatus\": 0,\n      \"rayName\": \"637f925cbec96d7c\",\n      \"ruleId\": \"bd706145258349c686ddb32b94dxxxxx\",\n      \"source\": \"firewallrules\",\n      \"userAgent\": \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\"\n    }\n  ]\n}\n```\n\n# Cloudflare Zone Analytics API Script (deprecated)\n\nThis Cloudflare Zone Analytics API script, `cf-analytics.sh` is now deprecated due to Cloudflare switching Zone analytics API to the new Cloudflare GraphQL API. This script supports both traditional Cloudflare Global API Token authentication (`CF_GLOBAL_TOKEN='y'`) and newer non-global Cloudflare permission based API Token authentication (`CF_GLOBAL_TOKEN='n'`) which is currently in beta testing. The `cf-analytics.sh` script is currently default to `CF_GLOBAL_TOKEN='n'` for testing purposes.\n\nIf you have Cloudflare Argo enabled on your CF zone, also set `CF_ARGO='y'` - currently enabled by default for testing purposes.\n\n## Usage\n\n```\nexport zid=YOUR_CLOUDFLARE_DOMAIN_ZONE_ID\nexport cfkey=YOUR_CLOUDFLARE_API_KEY\nexport cfemail=YOUR_CLOUDFLARE_ACCOUNT_EMAIL\n```\n\n```\n./cf-analytics.sh \n./cf-analytics.sh {6hrs|12hrs|24hrs|week|month|custom}\n```\n\n```\n./cf-analytics.sh 24hrs                  \n------------------------------------------------------------------\n  Cloudflare Argo Analytics\n------------------------------------------------------------------\n  since: 2019-05-14T08:25:00Z\n  until: 2019-05-16T08:25:00Z\n------------------------------------------------------------------\n  Argo Response Time:\n------------------------------------------------------------------\n  request-without-argo: 12444\n  request-with-argo: 112867\n  argo-smarted-routed: 86.9%\n  argo-improvement: 60.3600%\n  without-argo: 391 (milliseconds)\n  with-argo 155 (milliseconds)\n------------------------------------------------------------------\n  Argo Cloudflare Datacenter Response Times\n------------------------------------------------------------------\n  ATL  27726  0.6412169622075149   332.2533929162529   119.20688162735338\n  IAD  20332  0.637232322143707    325.6395870736086   118.13151682077513\n  FRA  12189  0.5799126291327171   456.80453879941433  191.89781770448766\n  AMS  11529  0.5992252513882197   449.694421657096    180.22616879174257\n  SEA  7162   0.40508913312922673  115.13461538461539  68.49483384529461\n  CDG  3421   0.6144501422449614   516.3040345821325   199.06094709149372\n  SIN  3294   0.5962180930008604   595.7072829131653   240.53582270795386\n  LHR  2993   0.607285979424051    495.1811594202899   194.46458402940195\n  KBP  2628   0.630100508063133    664.1783216783217   245.67922374429224\n  EWR  2165   0.5481618158546426   301.8181818181818   136.3729792147806\n  HKG  1858   0.5351932505240897   481.1136363636364   223.6248654467169\n  ARN  1776   0.5904696408044352   523.052995391705    214.2060810810811\n  NRT  1719   0.5622481824455847   371.9059405940594   162.8025014543339\n  YVR  1579   0.47559111222426925  143.32914572864323  75.16307789740343\n  DME  1438   0.6299202921502316   715.1506024096385   264.6627260083449\n  MIA  1396   0.5052764125545139   274.3493150684931   135.72707736389685\n  AKL  1229   0.47349360130316764  678.6486486486486   357.3128559804719\n  GRU  1228   0.5791630868985488   727.2328244274809   306.0464169381107\n  DUB  1085   0.7477442456057896   723.125             182.41244239631337\n  MUC  958    0.5202992390439672   476.3429752066116   228.50208768267223\n  ORD  827    0.5596108552294217   200.08823529411765  88.11668681983072\n  ATH  646    0.6528382488219177   682.1794871794872   236.8266253869969\n  HAM  645    0.3746478854738678   347.1470588235294   217.0891472868217\n  LED  624    0.5968830264246223   589                 237.43589743589743\n  SJC  538    0.5174183945246018   384.4718309859155   185.53903345724908\n  DFW  537    0.49549020899323587  166.60714285714286  84.05493482309124\n  MXP  496    0.6310643720804437   537.8921568627451   198.44758064516128\n  BUD  496    0.6345091268874329   590.5392156862745   215.8366935483871\n  LAX  480    0.33667051911778867  163.25471698113208  108.29166666666667\n  total-argo-reqs: 112994\n  datacenter-calc-avg-resp-without: 391.3434\n  datacenter-calc-avg-resp-with: 155.0828\n  argo-improvement:\n      min: 0.3367\n      avg: 0.5613\n      max: 0.7477\n      stddev: 0.0890\n  argo-resp-time-without-argo:\n      min: 115.1346\n      avg: 449.2464\n      max: 727.2328\n      stddev: 187.9968\n  argo-resp-time-with-argo:\n      min: 68.4948\n      avg: 186.7645\n      max: 357.3129\n      stddev: 69.3717\n\n------------------------------------------------------------------\n  Cloudflare Zone Analytics\n------------------------------------------------------------------\n  since: 2019-05-15T08:00:00Z\n  until: 2019-05-16T08:00:00Z\n------------------------------------------------------------------\n  Requests:\n------------------------------------------------------------------\n  requests all: 210786\n  requests cached: 121962\n  requests uncached: 88824\n  requests ssl-encrypted: 192936\n  requests ssl-unencrypted: 17850\n\n------------------------------------------------------------------\n  Pageviews:\n------------------------------------------------------------------\n  \"all\": 68410,\n  \"search_engine\": \n    \"applebot\": 48,\n    \"baiduspider\": 59,\n    \"bingbot\": 3425,\n    \"duckduckgobot\": 16,\n    \"facebookexternalhit\": 32,\n    \"googlebot\": 8782,\n    \"twitterbot\": 21,\n    \"yandexbot\": 191\n\n------------------------------------------------------------------\n  Requests HTTP Status Codes:\n------------------------------------------------------------------\n  \"200\": 158097,\n  \"206\": 56,\n  \"301\": 5664,\n  \"302\": 16122,\n  \"303\": 20509,\n  \"304\": 3239,\n  \"307\": 2725,\n  \"400\": 6,\n  \"401\": 48,\n  \"403\": 1122,\n  \"404\": 2213,\n  \"405\": 31,\n  \"416\": 20,\n  \"499\": 836,\n  \"500\": 49,\n  \"520\": 30,\n  \"521\": 4,\n  \"522\": 13,\n  \"524\": 2\n\n------------------------------------------------------------------\n  Requests SSL Protocols:\n------------------------------------------------------------------\n  \"TLSv1.2\": 107921,\n  \"TLSv1.3\": 85015,\n  \"none\": 17850\n\n------------------------------------------------------------------\n  Requests Content Types:\n------------------------------------------------------------------\n  \"css\": 11045,\n  \"empty\": 4068,\n  \"gif\": 1601,\n  \"html\": 116691,\n  \"javascript\": 32455,\n  \"jpeg\": 3845,\n  \"json\": 2687,\n  \"octet-stream\": 687,\n  \"other\": 7722,\n  \"plain\": 541,\n  \"png\": 17120,\n  \"svg\": 16,\n  \"webp\": 10769,\n  \"xml\": 1539\n\n------------------------------------------------------------------\n  Requests IP Class:\n------------------------------------------------------------------\n  \"backupService\": 8,\n  \"badHost\": 266,\n  \"monitoringService\": 1187,\n  \"noRecord\": 164488,\n  \"searchEngine\": 26197,\n  \"tor\": 36,\n  \"unknown\": 17720,\n  \"whitelist\": 884\n\n------------------------------------------------------------------\n  Requests Country Top 20:\n------------------------------------------------------------------\n  \"US\": 75093\n  \"DE\": 25898\n  \"FR\": 12666\n  \"GB\": 9121\n  \"IN\": 8321\n  \"NL\": 6328\n  \"AU\": 6125\n  \"JP\": 5803\n  \"SG\": 5646\n  \"CN\": 4989\n  \"RU\": 4236\n  \"VN\": 3769\n  \"BR\": 3207\n  \"IT\": 2620\n  \"UA\": 2540\n  \"ID\": 2433\n  \"CA\": 2113\n  \"IE\": 1946\n  \"ES\": 1822\n  \"PL\": 1702\n\n------------------------------------------------------------------\n  Bandwidth:\n------------------------------------------------------------------\n  bandwidth all: 3965159403\n  bandwidth cached: 2828614040\n  bandwidth uncached: 1136545363\n  bandwidth ssl-encrypted: 3942345957\n  bandwidth ssl-unencrypted: 22813446\n\n------------------------------------------------------------------\n  Bandwidth SSL Protocols:\n------------------------------------------------------------------\n  \"TLSv1.2\": 107921,\n  \"TLSv1.3\": 85015,\n  \"none\": 17850\n\n------------------------------------------------------------------\n  Bandwidth Content Types:\n------------------------------------------------------------------\n  \"css\": 110432021,\n  \"empty\": 1613685,\n  \"gif\": 23706010,\n  \"html\": 1378194797,\n  \"javascript\": 383366648,\n  \"jpeg\": 22221380,\n  \"json\": 3169046,\n  \"octet-stream\": 1421601743,\n  \"other\": 318212843,\n  \"plain\": 7690615,\n  \"png\": 179223248,\n  \"svg\": 444479,\n  \"webp\": 82602938,\n  \"xml\": 32679950\n\n------------------------------------------------------------------\n  Bandwidth Country Top 20:\n------------------------------------------------------------------\n  \"US\": 1170533462\n  \"DE\": 546377403\n  \"SG\": 339702426\n  \"CA\": 194209335\n  \"FR\": 160271949\n  \"GB\": 149483971\n  \"RU\": 149136945\n  \"JP\": 138803647\n  \"CN\": 116845836\n  \"VN\": 114655733\n  \"NL\": 100682606\n  \"IN\": 89108683\n  \"UA\": 76885477\n  \"AU\": 75727230\n  \"XX\": 56446705\n  \"IT\": 53701367\n  \"ID\": 43347263\n  \"BR\": 32500156\n  \"IE\": 26437821\n  \"ES\": 23383311\n\n------------------------------------------------------------------\n  Threats:\n------------------------------------------------------------------\n  \"all\": 59,\n  \"type\": \n    \"bic.ban.unknown\": 59\n  ,\n  \"country\": \n    \"BG\": 1,\n    \"CA\": 4,\n    \"DE\": 1,\n    \"ES\": 1,\n    \"PL\": 1,\n    \"RO\": 3,\n    \"UA\": 46,\n    \"US\": 2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentminmod%2Fcf-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcentminmod%2Fcf-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentminmod%2Fcf-analytics/lists"}