Splunk Search

Adding filed format to dynamic field names

gajananh999
Contributor

Dear All

Hope you are doing good.

I want to add the $ to my data but field name is dynamic so how can i add $ to my data which is coming for dynamic field

like this ex

Product 20-25 30-35 35-40

prod 1 $1,000 $2,000 $3,000

prod 2 $4,000 $5.000 $6.000

If there are actual field like age then i can do it by age= "$"+ age
but here i don't know the how to do for dynamic field

Can anyone please help me on this.

Thanks
Gajanan Hiroji

Tags (1)
1 Solution

aholzer
Motivator

Try this:

chart eval("$"+sum(Total_Covered_Amount)) over Product_Name by Age

View solution in original post

aholzer
Motivator

Try this:

chart eval("$"+sum(Total_Covered_Amount)) over Product_Name by Age

aholzer
Motivator

This should do the trick:

eval("$"+toString(sum(Total_Covered_Amount),"commas"))

0 Karma

gajananh999
Contributor

Its done eval("$"+tostring(sum(Total_Covered_Amount),"commas"))

This will gives you commas also..

0 Karma

gajananh999
Contributor

Ya Thank you .... this works fine for me can you please tell me how to add comma for that value

0 Karma

gajananh999
Contributor

See This is my search :
index="inforce_analytix"|eval Age=2013-Subscriber_Year |bin Age span=5| chart sum(Total_Covered_Amount) over Product_Name by Age | rename Product_Name as "Product Name"

I want get data like as i shown in above comment so the so here field will be like 20-25,25-30,30-35

0 Karma

rgcurry
Contributor

For me, your question is not quite clear. In your example, what is the "dynamic field name"? What makes it dynamic? If what you are asking is the value of those items in your example as "prod 1" and "prod 2" change, how is that represented in your data source? Please provide an exmaple of the data source and perhaps we can find a way to get what you want.

0 Karma

gajananh999
Contributor

Can Anyone reply me on this.

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...