Splunk Search

How to edit my search to add commas to the numbers and rename the row names?

elijahputnam
New Member

Hello,

I have two questions.

1) In my search below, I am trying to add Commas to the numbers, but the Totals field disappears when the search is using commas. When I remove stats count by action | eval count = tostring(count, "commas"), everything shows up as expected, but without the commas.

index=pan_logs  sourcetype=pan:threat  log_subtype!=url action=allowed OR action=blocked severity!=informational severity!=low| stats count by action | eval count = tostring(count, "commas") | fields action count | rename action AS "Action", count as "Attempts" | addcoltotals|fillnull value="Total""

2) I would like to rename the row names. As you can see, I have already successfully renamed the columns, but I want to capitalize the rows as well.

Thank you

Tags (4)
0 Karma

woodcock
Esteemed Legend

The problem is that once you convert "count" from an integer to a "string", any "adding" function can no longer work. So move the tostring to the end like this:

index=pan_logs  sourcetype=pan:threat  log_subtype!=url action=allowed OR action=blocked severity!=informational severity!=low
| stats count AS Attempts BY action
| addcoltotals
| fillnull value="Total""
| eval count = tostring(Attempts, "commas")
| rename action AS "Action"
0 Karma

sundareshr
Legend

Try this

 index=pan_logs  sourcetype=pan:threat  log_subtype!=url action=allowed OR action=blocked severity!=informational severity!=low | stats count by action | fields action count | rename action AS "Action", count as "Attempts" | addcoltotals|fillnull value="Total"  | eval Action=upper(Action) | eval count = tostring(count, "commas") 
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...