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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...