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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

A Four-Part Event Series: Full Stack Observability For the AI Era

As AI reshapes applications, infrastructure, and the way teams operate, the traditional boundaries of ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...