Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính9.5k · #12265

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.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/openclaw/clawhub/blob/main/.agents/skills/spl-to-apl/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

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

  1. Time is explicit in APL: SPL time pickers don't translate — add where _time between (ago(1h) .. now())
  2. Structure: SPL index=... | command → APL ['dataset'] | operator
  3. Join is preview: limited to 50k rows, inner/innerunique/leftouter only
  4. cidrmatch args reversed: SPL cidrmatch(cidr, ip) → APL ipv4_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

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự