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!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...