spl-to-apl
Skill này làm gì
Skill này chuyển các tìm kiếm Splunk SPL sang APL của Axiom. Nó dành cho các nhóm đang chuyển từ Splunk sang Axiom, hoặc muốn học APL từ các mẫu SPL đã quen.
Khi nào nên dùng
- ✓Khi bạn đang chuyển các tìm kiếm log từ Splunk sang Axiom.
- ✓Khi bạn có một tìm kiếm Splunk và cần truy vấn Axiom tương đương.
- ✓Khi bạn muốn biết một lệnh Splunk phổ biến được viết thế nào trong APL.
Liên kết skill
https://github.com/openclaw/clawhub/blob/main/.agents/skills/spl-to-apl/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Chuyển tìm kiếm Splunk này sang truy vấn Axiom: index=web status>=500 | stats count by host.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent ánh xạ từng lệnh Splunk sang lệnh APL tương ứng, chẳng hạn stats để tổng hợp và eval để mở rộng. Nó thêm khoảng thời gian mà Axiom cần, và ép kiểu các trường văn bản sang số khi phép so sánh cần đến.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
SPL to APL Translator
Type safety: Fields like status are often stored as strings. Always cast before numeric comparison: toint(status) >= 500, not status >= 500.
Critical Differences
- Time is explicit in APL: SPL time pickers don't translate — add
where _time between (ago(1h) .. now()) - Structure: SPL
index=... | command→ APL['dataset'] | operator - Join is preview: limited to 50k rows, inner/innerunique/leftouter only
- cidrmatch args reversed: SPL
cidrmatch(cidr, ip)→ APLipv4_is_in_range(ip, cidr)
Core Command Mappings
| SPL | APL | Notes |
|---|---|---|
search index=... |
['dataset'] |
Dataset replaces index |
search field=value |
where field == "value" |
Explicit where |
where |
where |
Same |
stats |
summarize |
Different aggregation syntax |
eval |
extend |
Create/modify fields |
table / fields |
project |
Select columns |
fields - |
project-away |
Remove columns |
rename x as y |
project-rename y = x |
Rename |
sort / sort - |
order by ... asc/desc |
Sort |
head N |
take N |
Limit rows |
top N field |
summarize count() by field | top N by count_ |
Two-step |
dedup field |
summarize arg_max(_time, *) by field |
Keep latest |
rex |
parse or extract() |
Regex extraction |
join |
join |
Preview feature |
append |
union |
Combine datasets |
mvexpand |
mv-expand |
Expand arrays |
timechart span=X |
summarize ... by bin(_time, X) |
Manual binning |
rare N field |
summarize count() by field | order by count_ asc | take N |
Bottom N |
spath |
parse_json() or json['path'] |
JSON access |
transaction |
No direct equivalent | Use summarize + make_list |
Complete mappings: reference/command-mapping.md
Stats → Summarize
# SPL
| stats count by status
# APL
| summarize count() by status
Key function mappings
| SPL | APL |
|---|---|
count |
count() |
count(field) |
countif(isnotnull(field)) |
dc(field) |
dcount(field) |
avg/sum/min/max |
Same |
median(field) |
percentile(field, 50) |
perc95(field) |
percentile(field, 95) |
first/last |
arg_min/arg_max(_time, field) |
list(field) |
make_list(field) |
values(field) |
make_set(field) |
Conditional count pattern
# SPL
| stats count(eval(status>=500)) as errors by host
# APL
| summarize errors = countif(status >= 500) by host
Complete function list: reference/function-mapping.md
Eval → Extend
# SPL
| eval new_field = old_field * 2
# APL
| extend new_field = old_field * 2
Key function mappings
| SPL | APL | Notes |
|---|---|---|
if(c, t, f) |
iff(c, t, f) |
Double 'f' |
case(c1,v1,...) |
case(c1,v1,...,default) |
Requires default |
len(str) |
strlen(str) |
|
lower/upper |
tolower/toupper |
|
substr |
substring |
0-indexed in APL |
replace |
replace_string |
|
tonumber |
toint/tolong/toreal |
Explicit types |
match(s,r) |
s matches regex "r" |
Operator |
split(s, d) |
split(s, d) |
Same |
mvjoin(mv, d) |
strcat_array(arr, d) |
Join array |
mvcount(mv) |
array_length(arr) |
Array length |
Case statement pattern
# SPL
| eval level = case(
status >= 500, "error",
status >= 400, "warning",
1==1, "ok"
)
# APL
| extend level = case(
status >= 500, "error",
status >= 400, "warning",
"ok"
)
Note: SPL's 1==1 catch-all becomes implicit default in APL.
Rex → Parse/Extract
# SPL
| rex field=message "user=(?<username>\w+)"
# APL - parse with regex
| parse kind=regex message with @"user=(?P<username>\w+)"
# APL - extract function
| extend username = extract("user=(\\w+)", 1, message)
Simple pattern (non-regex)
# SPL
| rex field=uri "^/api/(?<version>v\d+)/(?<endpoint>\w+)"
# APL
| parse uri with "/api/" version "/" endpoint
Time Handling
SPL time pickers don't translate. Always add explicit time range:
# SPL (time picker: Last 24 hours)
index=logs
# APL
['logs'] | where _time between (ago(24h) .. now())
Timechart translation
# SPL
| timechart span=5m count by status
# APL
| summarize count() by bin(_time, 5m), status
Common Patterns
Error rate calculation
# SPL
| stats count(eval(status>=500)) as errors, count as total by host
| eval error_rate = errors/total*1
Câu hỏi thường gặp
Bộ chọn thời gian của Splunk có được mang sang không?
Không. Trong APL, khoảng thời gian phải được viết trực tiếp vào truy vấn, nên skill sẽ thêm nó.
Mọi lệnh Splunk có được hỗ trợ không?
Skill liệt kê các ánh xạ phổ biến và ghi chú các khác biệt, chẳng hạn join hiện là tính năng preview trong APL.
Vì sao một số trường được ép sang số?
Status và các trường tương tự thường được lưu dưới dạng văn bản, nên cần chuyển đổi trước khi kiểm tra bằng số.
Chi tiết
Mô tả gốc của tác giả
Translates Splunk SPL queries to Axiom APL. Provides command mappings, function equivalents, and syntax transformations. Use when migrating from Splunk, converting SPL queries, or learning APL equivalents of SPL patterns.
repo: openclaw/clawhub
Độ phổ biến
- Sao GitHub
- 9.5k
- Vị trí xếp hạng
- #12265
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
axiom-alerting
9.5kGiúp agent của bạn tạo và quản lý monitor cùng các tuyến thông báo của Axiom qua API Axiom, và kiểm tra cảnh báo hoạt động đúng như mong đợi.
axiom-sre
9.5kGiúp agent của bạn điều tra sự cố và lỗi production từng bước, kiểm tra mỗi giả thuyết với log Axiom trước khi đưa ra kết luận.
building-dashboards
9.5kGiúp agent của bạn thiết kế dashboard Axiom với biểu đồ, truy vấn và bộ lọc phù hợp, bắt đầu từ các quyết định mà dashboard phải hỗ trợ.
controlling-costs
9.5kGiúp agent của bạn tìm dữ liệu không dùng đến trong Axiom và xây dựng dashboard cùng monitor để theo dõi và giảm chi phí ghi log.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.