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!

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 ...