数据加工主要解决用户规整数据的痛点以及帮助用户进一步挖掘数据的价值,降低时间与人力成本。合理配置可以节约一定的成本,本文档介绍如何以较优的成本方式使用数据加工功能。
典型配置
成本因素
- 每日导入的数据量。
- 数据存储的时间。
- 是否建立索引。
根据成本因素,本文通过如下两个案例介绍如何进行成本优化。
优化存储结构
如果您持续采集某应用的日志,每天的写入量为100GB,存储30天并建立全文索引,那么日志服务的成本大约是2248元/每月。
- 构建接入源Logstore,存储3天不建立索引。
- 构建目标Logstore1,用于存储用户操作日志与错误日志,存储30天并建立索引。
- 构建目标logstore2,用于存储一般性日志,存储7天并建立索引。
这种情况下您的成本约为1672元/每月,与加工之前相比大约可以节省25%的成本。
如果您的原始日志存储周期为60天,可以通过数据加工将只关心的20%的日志存储60天,其他日志存储7天即可,这样可以节约12%的成本, 并对关心的日志增加1倍存储时间。
优化存储内容
如果您持续采集某应用的日志,每天的写入量为100GB,存储30天并建立全文索引,那么日志服务的成本大约是2248元/每月。
__source__: 1.2.3.4
__topic__: ddos_access_log
body_bytes_sent: 3866
cc_action: none
cc_blocks:
cc_phase:
content_type: text/x-flv
host: www.dbb.mock-domain.com
http_cookie: i1=w1;x2=q2
http_referer: http://www.cbc.mock-domain.com
http_user_agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
http_x_forwarded_for: 105.120.151.10
https: true
isp_line: BGP
matched_host: www.cbd.mock-host.com
method: GET
real_client_ip: 105.120.160.17
remote_addr: 105.120.160.0
remote_port: 48196
request_length: 2946
request_method: GET
request_time_msec: 78920
request_uri: /request/nvwlvvkhw
server_name: www.bd.mock-host.com
status: 502
time: 2019-07-22T17:40:26+08:00
ua_browser: mozilla
ua_browser_family:
ua_browser_type:
ua_browser_version: 9.0
ua_device_type:
ua_os: windows_7
ua_os_family:
upstream_addr: 106.120.157.15:80
upstream_ip: 109.120.152.11
upstream_response_time: 0.858
upstream_status: 200
user_id: st0s2b5
- 构建接入源Logstore,存储3天不建立索引。
- 构建目标Logstore,用于存储操作日志与错误日志,存储30天并建立索引。
假设每条日志经过加工后大小约为原来的60%,这种情况下您的成本约为1579元/每月,与加工之前相比大约可以节省30%的成本。
__source__: 1.2.3.4
__topic__: ddos_access_log
body_bytes_sent: 3866
content_type: text/x-flv
host: www.dbb.mock-domain.com
http_referer: http://www.cbc.mock-domain.com
ua_browser: mozilla
ua_browser_family:
ua_browser_type:
ua_browser_version: 9.0
ua_device_type:
ua_os: windows_7
http_x_forwarded_for: 105.120.151.10
matched_host: www.cbd.mock-host.com
method: GET
real_client_ip: 105.120.160.17
request_length: 2946
request_uri: /request/nvwlvvkhw
status: 502
upstream_addr: 106.120.157.15:80
upstream_ip: 109.120.152.11
upstream_response_time: 0.858
upstream_status: 200
user_id: st0s2b5