spl-to-apl
できること
このスキルは、Splunkの検索(SPL)をAxiomのAPLに変換します。SplunkからAxiomへ移行するチームや、慣れたSPLの形からAPLを学びたい人向けです。
使う場面
- ✓ログ検索をSplunkからAxiomに移しているとき。
- ✓Splunkの検索があり、同じ内容のAxiomのクエリが必要なとき。
- ✓よく使われるSplunkのコマンドがAPLでどう書かれるか知りたいとき。
スキルのリンク
https://github.com/openclaw/clawhub/blob/main/.agents/skills/spl-to-apl/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“index=web status>=500 | stats count by host という Splunk の検索を、Axiom のクエリに変換してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、各Splunkのコマンドを対応するAPLのコマンドに置き換えます。たとえば、statsは集計に、evalは項目の追加に対応します。また、Axiomに必要な時間範囲を追加し、数値の比較が必要な場合はテキストの項目を数値に変換します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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
よくある質問
Splunkの時間ピッカーは引き継がれますか?
いいえ。APLでは時間範囲をクエリに書き込む必要があるため、このスキルがそれを追加します。
すべてのSplunkコマンドに対応していますか?
いいえ。よく使われる対応表を示し、違いも説明します。たとえば、joinはAPLではプレビュー機能です。
一部の項目を数値に変換するのはなぜですか?
ステータスなどの項目はテキストとして保存されることが多いため、数値の比較をする前に変換が必要だからです。
詳細
作者による元の説明
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
人気
- GitHubのスター
- 9.5k
- ランキング
- #12265
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
axiom-alerting
9.5kエージェントが、Axiom APIを通じてAxiomのモニターと通知のルートを作って管理し、アラートが期待どおり動くかを確認できるよう支援します。
axiom-sre
9.5kエージェントが、本番のインシデントやバグを段階的に調べ、各推測をAxiomのログに照らして検証してから結論を出せるよう支援します。
building-dashboards
9.5kエージェントが、何の判断を支えるべきかという点から始めて、適切なグラフ、クエリ、フィルターを使ったAxiomのダッシュボードを設計できるよう支援します。
controlling-costs
9.5kエージェントが、Axiomで誰も使っていないデータを見つけ、ログのコストを追跡して抑えるダッシュボードとモニターを作れるよう支援します。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。