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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...