Splunk Search

項目名に変数の値を設定できるか

1014502
New Member

お世話になります。

項目名に月の値を入れたいです。
現在検討している方法は別カラムに月の値(2020-03)を設定し、【予定】という項目の先頭に月の値(2020-03)をセットして、
【2020-03予定】という項目名にしたいのですが、実現方法がわかりません。

どのような方法があるか教えてください。

Labels (1)
0 Karma
1 Solution

to4kawa
Ultra Champion
| makeresults
| eval month_value="2020-03"
| eval schedule="working"
| eval {month_value}schedule=schedule

View solution in original post

0 Karma

to4kawa
Ultra Champion
| makeresults
| eval month_value="2020-03"
| eval schedule="working"
| eval {month_value}schedule=schedule
0 Karma

1014502
New Member

情報をもう少し詳細に記載します。
|eval "選択月" = substr(month,0,7) // ここで選択された月を取得しています。
|stats sum('estimate_hours') as ‘”‘予定時間" //estimate_hoursをsumした結果を予定時間という項目として結果を格納

作成した予定時間という項目名に選択月を付けて、【yyyy-mm予定時間】という項目名にすることができませんでしょうか。
回答頂いたソースを参考に、以下のように記載してみましたが、うまくできませんでした。
|eval "選択月" = substr(month,0,7)

|eval "予定時間"="予定時間"
|stats sum('estimate_hours') as"予定時間"
|eval {選択月}予定時間='予定時間'

単純にrename コマンドで変更できそうだと思ったのですが、選択月の値が反映されないです。

恐れ入りますがよろしくお願い致します。

0 Karma

to4kawa
Ultra Champion
....
|eval select= substr(month,0,7)
|stats sum('estimate_hours') as prep by select
|eval 【{select}予定時間】=prep
0 Karma
Get Updates on the Splunk Community!

Splunk Observability Synthetic Monitoring - Resolved Incident on Detector Alerts

We’ve discovered a bug that affected the auto-clear of Synthetic Detectors in the Splunk Synthetic Monitoring ...

Video | Tom’s Smartness Journey Continues

Remember Splunk Community member Tom Kopchak? If you caught the first episode of our Smartness interview ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud? Learn how unique features like ...