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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...