Splunk Search

How to format fields globally based on the data type used?

ronak
Path Finder

Hello

Is there any way by which I can set the formatting at once central place and it takes effect wherever that data type is used. For example, I define types like US_CURRENCY, NUMBER_WITH_COMMAS, etc...and then in query I can simply mark the field to be US_CURRENCY so that it is represented as $389.90 instead of 380.90

Any pointers would be appreciated

thanks, ronak

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You could create a macro US_CURRENCY(1) that takes the field as its argument and is defined something like this:

fieldformat $field$ = "$$".'$field$'

and use it in your searches like this:

some search | `US_CURRENCY(total)` | ...
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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