aliyun sls常用sql

1.查询访问次数

* | select http_referer as ww,count(*) as cc  group by ww order by ww ASC

http_referer 更换即可

2.以 X-Forwarded-For 、Url、访问次数制作表格分析 (近1天的数据)


* | SELECT 
    regexp_extract(__raw_log__, 'X-Forwarded-For=([^,]+)', 1) AS client_ip,
    regexp_extract(__raw_log__, 'Url:([^,]+)', 1) AS request_url,
    count(*) AS access_count
WHERE 
    __time__ >= to_unixtime(date_add('second', -86400, now())) AND 
    __time__ <to_unixtime(now())
GROUP BY client_ip, request_url
ORDER BY access_count DESC
LIMIT 100

posted @ 2024-06-07 18:48  六月OvO  阅读(12)  评论(0)    收藏  举报