![見出し画像](https://assets.st-note.com/production/uploads/images/154345012/rectangle_large_type_2_e42ac194ab760ef9b591ecefdc7ca60a.png?width=1200)
すごいログ分析ツール(TWSLA) v1.5.0リリース
TWSLA v1.5.0をリリースしました。
今回からgoreleaserとGitHUB Actionsを使って自動リリースしています。
主な変更点は、
ログの検索結果をカラー表示する機能
relationコマンド
heatmapコマンド
グラフをgo-echartsで出力する機能
Homebrewでのインストール
です。
マインドマップは
![](https://assets.st-note.com/img/1726352515-PzxRDrmgwOstkJnNXTHlcMa8.png?width=1200)
です。
ログの検索結果をカラー表示する機能
ログを検索するseachコマンドのオプションに
-c,--colorを追加しました。以下のキーを指定できます。
ip:IPアドレスをカラー表示
mac:MACアドレスをカラー表示
email:メールアドレスをカラー表示
url:URLをカラー表示
filter:フィルターで指定した文字列をカラー表示
regexp/パターン/カラー:正規表現にマッチした文字列を指定した色で表示
twsla search -f Failed -c "regex/user\s+\S+/9,ip,filter"
のような指定で
![](https://assets.st-note.com/img/1726352372-z2Sn8RiVJQ7ITCkOEj4MuUvm.png?width=1200)
relationコマンド
ログの行にある2つ以上の項目の関係をリストアップします。有指向グラフに出力することもできます。
twsla help relation
Analyzes the relationship between two or more pieces of data extracted from a log,
such as the relationship between an IP address and a MAC address.
data entry is ip | mac | email | url | regex/<pattern>/<color>
Usage:
twsla relation <data1> <data2>... [flags]
Flags:
-h, --help help for relation
Global Flags:
--config string config file (default is $HOME/.twsla.yaml)
-d, --datastore string Bblot log db (default "./twsla.db")
-f, --filter string Simple filter
-v, --not string Invert regexp filter
-r, --regex string Regexp filter
-t, --timeRange string Time range
指定可能な項目は
ip:IPアドレス
mac:MACアドレス
email:メールアドレス
url:URL
regexp/パターン/:正規表現にマッチした文字列
です。
twsla relation -f Failed -r user "regex/user\s+\S+/" ip
のようなコマンドで
![](https://assets.st-note.com/img/1726353083-BqirWujM71SKVH8C4PxvAp3c.png?width=1200)
のように集計できます。フィルターを工夫して件数を絞れば
![](https://assets.st-note.com/img/1726353165-WJsqapUnrloQG6OSH5ZyxcRd.png?width=1200)
のようなグラフも出力できます。s:Saveコマンドの出力ファイルの拡張子をhtmlに指定します。
heatmapマップコマンド
曜日または日付単位でログの多い時間帯をヒートマップで表示するためのコマンドです。
twsla help heatmap
Command to tally log counts by day of the week and time of day
Aggregate by date mode is also available.
Usage:
twsla heatmap [flags]
Flags:
-h, --help help for heatmap
-w, --week Week mode
Global Flags:
--config string config file (default is $HOME/.twsla.yaml)
-d, --datastore string Bblot log db (default "./twsla.db")
-f, --filter string Simple filter
-v, --not string Invert regexp filter
-r, --regex string Regexp filter
-t, --timeRange string Time range
-w オプションを指定すると曜日単位で集計します。指定しない場合に日付単位です。
日付単位は
![](https://assets.st-note.com/img/1726353543-wqoYWigZRlP08ryN3bBQ7FdA.png?width=1200)
拡張子htmlのファイルの保存すると
![](https://assets.st-note.com/img/1726353570-YmopMbx9G4AVaQdZBgOfIyF1.png?width=1200)
のようなグラフを保存できます。
曜日単位は
![](https://assets.st-note.com/img/1726353653-xtNWrOphvf3ilHIyA4eTMjuD.png?width=1200)
![](https://assets.st-note.com/img/1726353686-cnk0bHfghXTpDFe2jdSYMA5r.png?width=1200)
です。
グラフをgo-echartsで出力する機能
s:Saveで拡張子をhtmlにするとgo-echartsでグラフを保存します。ブラウザーで開いてみてください。拡張子pngを指定すれば、これまで通り画像で保存できます。ただし、ヒートマップは画像で出力できません。
Homebrewでのインストール
Mac OSとLinux 環境では、brewコマンドでインストールできます。
$brew install twsnmp/tap/twsla
です。
いいなと思ったら応援しよう!
![twsnmp](https://assets.st-note.com/production/uploads/images/14333815/profile_ee1accba5615957e5029db85d57fdb0a.jpg?width=600&crop=1:1,smart)