日志功能SLS帮助您采集、存储接入办公安全平台SASE(Secure Access Service Edge)的Web访问和攻击防护日志,并基于阿里云日志服务,支持查询分析、统计图表、告警服务等功能,帮助您专注于分析,远离琐碎的查询和整理工作。本文介绍了如何开通和使用SLS日志。
前提条件
已开通SASE的日志存储服务。具体操作,请参见购买办公安全平台。
操作步骤
- 登录办公安全平台控制台。
- 在左侧导航栏,选择 。
- 购买日志存储服务和日志存储容量。
- 开启日志采集。在日志分析页面,设置右上角的日志状态为开启。
SASE默认不采集已接入SASE的网站业务的日志数据。只有当您为网站域名开启日志采集后,SASE才会采集该网站的日志数据,并将采集到的日志数据存储到日志服务专属日志库中,供您进行查询与分析。
- 设置查询时间。单击15分钟(相对),设置查询的时间范围。
您可以选择相对时间、整点时间和自定义时间范围。
- 在查询框中输入查询分析语句。
- 单击查询/分析,查看查询分析结果。
日志字段说明
字段 | 类型 | 名称 | 示例 |
---|---|---|---|
__time__ | text | 连接时间 | 2018-02-27 11:58:15 |
owner_id | text | 用户ID | 123456**** |
username | text | 用户名称 | 张三 |
department | text | 部门信息 | 测试部门 |
action | text | 动作 | block |
device_type | text | 设备类型 | windows |
domain | text | 域名 | www.aliyundoc.com |
dst_addr | text | 目的地址 | 10.2.*.*:** |
in_bytes | long | 入流量 | 234 |
out_bytes | long | 出流量 | 567 |
log_type | text | 日志类型 | ia_access_log |
policy_name | text | 策略名称 | test |
policy_type | text | 策略类型 | url_filter |
protocol | text | 协议 | tcp |
request_uri | text | 请求URI | /test.php |
src_addr | text | 源地址 | 10.4.*.*:** |
常用查询语句示例
- 查询拦截类型
* | select cc_action,cc_phase,count(*) as t group by cc_action,cc_phase order by t desc limit 10
- 查询QPS
* | select time_series(__time__,'15m','%H:%i','0') as time,count(*)/900 as QPS group by time order by time
- 查询被攻击域名
* and cc_blocks:1 | select cc_action,cc_phase,count(*) as t group by cc_action,cc_phase order by t desc limit 10
- 查询被攻击URL
* and cc_blocks:1 | select count(*) as times,host,request_path group by host,request_path order by times
- 查询请求详情
* | select date_format(date_trunc('second',__time__),'%H:%i:%s') as time,host,request_uri,request_method,status,upstream_status,querystring limit 10
- 查询5XX状态码详情
* and status>499 | select host,status,upstream_status,count(*)as t group by host,status,upstream_status order by t desc
- 查询请求时延分布
* | SELECT count_if(upstream_response_time<20) as "<20", count_if(upstream_response_time<50 and upstream_response_time>20) as "<50", count_if(upstream_response_time<100 and upstream_response_time>50) as "<100", count_if(upstream_response_time<500 and upstream_response_time>100) as "<500", count_if(upstream_response_time<1000 and upstream_response_time>500) as "<1000", count_if(upstream_response_time>1000) as ">1000"