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 Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...