Splunk Search

Insert % sign for each result in a specific column

hagjos43
Contributor

Current search results are in a table form such as the following:

Search String | Search Engine | Visits | Percent
Document123   | Google        | 25     | 9.0123
ABC123        | Yahoo         | 21     | 8.7501
HelloWorld    | Bing          | 2      | 1.0201

I'm attempting to have it displayed as the following:

Search String | Search Engine | Visits | Percent
Document123   | Google        | 25     | 9.0123%
ABC123        | Yahoo         | 21     | 8.7501%
HelloWorld    | Bing          | 2      | 1.0201%

Thanks in advance!
Joe

Tags (3)
1 Solution

gfreitas
Builder

Hi Joe,

You can simply do that:

| eval Percent = Percent + " %"

Hope this helps!!

View solution in original post

lguinn2
Legend

At the end of your search, add

| fieldformat Percent=tostring(Percent) + "%"

That should do it!

demkic
Explorer

Is it possible to also round to two decimal places in addition to adding the % at the end of the search?

0 Karma

demkic
Explorer

It's ok, I figured it out with the round(x,y) command.

0 Karma

gfreitas
Builder

Hi Joe,

You can simply do that:

| eval Percent = Percent + " %"

Hope this helps!!

hagjos43
Contributor

Perfect!!!

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...