updated check-worker tool [skip ci]
This commit is contained in:
parent
cbb9349b2f
commit
ca4455787a
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
read -r -d '' ASNS <<- EOF
|
read -r -d '' ASNS <<- EOF
|
||||||
8075: microsoft (github)
|
8075: microsoft (github actions)
|
||||||
EOF
|
EOF
|
||||||
read -r -d '' SQL <<- EOF
|
read -r -d '' SQL <<- EOF
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -10,11 +10,29 @@ read -r -d '' SQL <<- EOF
|
||||||
blob3 as asn,
|
blob3 as asn,
|
||||||
blob4 as timezone,
|
blob4 as timezone,
|
||||||
blob5 as timestamp,
|
blob5 as timestamp,
|
||||||
blob6 as ip
|
blob6 as ip,
|
||||||
|
blob7 as referer
|
||||||
FROM METRICS WHERE
|
FROM METRICS WHERE
|
||||||
timestamp != '' and
|
timestamp != '' and
|
||||||
ip != '$LOCAL_IP' and
|
ip != '$LOCAL_IP' and
|
||||||
asn != '8075'
|
asn != '8075'
|
||||||
ORDER BY timestamp
|
ORDER BY timestamp
|
||||||
EOF
|
EOF
|
||||||
curl -X POST "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/analytics_engine/sql" -H "Authorization: Bearer $CF_API_TOKEN" -d "$SQL" 2>/dev/null | jq '["ret", "verb", "xw", "asn", "timezone ", "datetime"], ["---","----","--","---","-------- ","--------"],(.data[] | [if .status_code == "" then "200" else .status_code end, .method, .country, .asn, .timezone, .timestamp]) | @tsv' -r | grep -v '2023-09-18T05:20'
|
# yeah i know this looks dumb but isn't it easy to understand?
|
||||||
|
read -r -d '' JQ <<- EOF
|
||||||
|
["ret","verb","xw","asn","timezone ","datetime ","referer"],
|
||||||
|
["---","----","--","---","-------- ","-------- ","-------"],
|
||||||
|
(
|
||||||
|
.data[] |
|
||||||
|
[
|
||||||
|
if .status_code == "" then "200" else .status_code end,
|
||||||
|
.method,
|
||||||
|
.country,
|
||||||
|
.asn,
|
||||||
|
.timezone,
|
||||||
|
.timestamp,
|
||||||
|
.referer
|
||||||
|
]
|
||||||
|
) | @tsv
|
||||||
|
EOF
|
||||||
|
curl -X POST "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/analytics_engine/sql" -H "Authorization: Bearer $CF_API_TOKEN" -d "$SQL" 2>/dev/null | jq "$JQ" -r | grep -v '2023-09-18T05:20'
|
||||||
|
|
Loading…
Reference in a new issue