Dashboards & Visualizations

How to display string values containing numbers as strings?

Dominik
Explorer

I extract with rex a field that contains numeric values, often with leading zeros. I want to display the values as strings, left aligned without getting leading zeros truncated.

Example values: 00123, 22222, 12345_67

When showing these values in a dashboard table, the String values are interpreted as numbers, where possible, and I get

                                 123
                            22222
12345_67

Is there a way to get string values correctly displayed as such in a dashboard table?

I tried also the dirty way as proposed here, prefixing the strings with space or non-breaking-space, but it does not work (I'm on Splunk 9.0.4). It works when adding a visible char (e.g. "x"), but that makes the table unusable.

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @Dominik,

I'm delaying the use of Dashboard Studio as long as I can  just for this reason: it still has some issue.

Anyway, using my search have you the same issue?

Ciao.

Giuseppe

 

View solution in original post

Dominik
Explorer

Thank you @gcusello for the reply..

Probably my question was not precise enough. The data is ok and the sample produces exactly what I have, but Dashboard Studio seems to have a problem.

Using the data from above in a table widget as data source, I can reproduce the problem.

Dominik_0-1691157563500.png

leading zeros cut off and colums formatted differently per row.

Playing around with this, I found a completely wired feature of the table widget. With a greater Result set, switching pages, it looks like the widget 'thinks' about the data and  if the majority of lines cannot be misinterpreted as numbers, the whole page is correctly displayed as left-aligned strings. Otherwise the data ist misinterpreted as numbers and changed (leading zeros cut off)..  Setting the Column formatting to string does not change anything.

In my untersanding, this is everything else than correct behavior for a display widget. But I'm a complete Splunk newbie and not sure if this is worth a bug report. Can you confirm that  this is really bad?

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Dominik,

I'm delaying the use of Dashboard Studio as long as I can  just for this reason: it still has some issue.

Anyway, using my search have you the same issue?

Ciao.

Giuseppe

 

Dominik
Explorer

I take "delaying the use of Dashboard Studio as long as I can" as good solution. 

Widgets that change data values are inacceptable. 😞

Worth a bug report?

0 Karma

Dominik
Explorer

Yes, as written above.  This is your example data. The data is perfect, the result fatal. 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Dominik,

using your data I didn't find any problem:

| makeresults
| eval _raw="00123, 22222, 12345_67"
| rex max_match=0 "(?<num>[^,\n]+)"
| mvexpand num
| eval num=tostring(trim(num))
| table num

could you share some full log sample to test the regex?

Ciao.

Giuseppe

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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...