Splunk Search

サーチ履歴を取得する方法は?

Splunk_Shinobi
Splunk Employee
Splunk Employee

サーチキーワードの履歴をリストして、
監査やナレッジ共有等に利用したいのですが履歴を取得することはできますか?

Tags (1)
0 Karma
1 Solution

melonman
Motivator

もし自分のユーザ上での履歴を取りたい場合には、

| history

全ユーザを対象としての履歴を取りたい場合には、

index=_audit action="search" search=* user!=splunk-system-user | table user search

などとしていただければ可能です。
ただし、searchフィールドにsearch=と指定されているキーサードが有ると、
そのままでは表示がうまくされないので、フィールド名の変更を行った上で、サーチ履歴をリストするとよいかもしれません。

以下のようにすると、サーチ履歴を集計することもできます。

index=_audit action="search" search=* user!=splunk-system-user | rex field=search max_match=1000 "|[ ]*(?\w+)" | stats count by term

term count

1 bin 127
2 bucket 204
3 convert 15
4 dbinfo 2
5 dbquery 13
6 dedup 142
7 delete 1

View solution in original post

piebob
Splunk Employee
Splunk Employee

historyコマンドは、検索履歴を示し
http://docs.splunk.com/Documentation/Splunk/5.0.2/SearchReference/History

ごめんなさい、私の日本語は下手です!

🙂

melonman
Motivator

もし自分のユーザ上での履歴を取りたい場合には、

| history

全ユーザを対象としての履歴を取りたい場合には、

index=_audit action="search" search=* user!=splunk-system-user | table user search

などとしていただければ可能です。
ただし、searchフィールドにsearch=と指定されているキーサードが有ると、
そのままでは表示がうまくされないので、フィールド名の変更を行った上で、サーチ履歴をリストするとよいかもしれません。

以下のようにすると、サーチ履歴を集計することもできます。

index=_audit action="search" search=* user!=splunk-system-user | rex field=search max_match=1000 "|[ ]*(?\w+)" | stats count by term

term count

1 bin 127
2 bucket 204
3 convert 15
4 dbinfo 2
5 dbquery 13
6 dedup 142
7 delete 1

Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...