Splunk Search

Table does not display correct field spaces

antlefebvre
Communicator

When piping fields into a table, the table eliminates extra spaces inside the field.

For example:

person_name="Smith  MD, John" |table person_name
                  ^^ (Two Spaces)

returns

Smith MD, John
     ^ (One Space)

This is terrible for forms when going from a broad * search to a single name search as copy/paste returns no results.

How do I get a table to return the field with ALL spaces that were in the raw event?

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

The table command isn't to blame, it preserves the double space - HTML's wrapping of multiple spaces into one is to blame.

<tr class="shared-resultstable-resultstablerow" data-cid="view7405" data-view="views/shared/results_table/ResultsTableRow" data-row-index="0" data-render-time="0.001">
  <td data-cell-index="0">
    Smith  MD, John
  </td>
</tr>

As you can see, the double space has made it into the source code, but your browser correctly only renders one space.

You could in principle set the CSS property white-space: pre; for that cell/column, but this would make all the whitespace around the cell appear as well.

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

The table command isn't to blame, it preserves the double space - HTML's wrapping of multiple spaces into one is to blame.

<tr class="shared-resultstable-resultstablerow" data-cid="view7405" data-view="views/shared/results_table/ResultsTableRow" data-row-index="0" data-render-time="0.001">
  <td data-cell-index="0">
    Smith  MD, John
  </td>
</tr>

As you can see, the double space has made it into the source code, but your browser correctly only renders one space.

You could in principle set the CSS property white-space: pre; for that cell/column, but this would make all the whitespace around the cell appear as well.

martin_mueller
SplunkTrust
SplunkTrust

The pedant in me would suggest that it's actually faulty data if there's more than one space in there. If your source agrees, you could set up an alert to get those responsible for the data to fix it on their end for greater overall quality - both in Splunk and in the source application.

0 Karma

antlefebvre
Communicator

Crap... thanks for the explanation.

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...