SPL语句
-- SPL处理结果定义为命名数据集src,作为后续SPL表达式的输入
.let src = *
| where status=cast(status as BIGINT);
-- 以命名数据集src作为输入,筛选status字段为5xx的数据,定义数据集err,不输出
.let err = $src
| where status >= 500
| extend msg='ERR';
-- 以命名数据集src作为输入,筛选status字段为2xx的数据,定义数据集ok,不输出
.let ok = $src
| where status >= 200 and status < 300
| extend msg='OK';
-- 输出命名数据集err和ok
$err;
$ok;输入数据
# 条目1
status: '200'
body: 'this is a test'
# 条目2
status: '500'
body: 'internal error'
# 条目3
status: '404'
body: 'not found'输出结果
# 条目1: 数据集为err
status: '500'
body: 'internal error'
msg: 'ERR'
# 条目2: 数据集为ok
status: '200'
body: 'this is a test'
msg: 'OK'