Splunk Search

How to add space on a text on a single value panel?

LearningGuy
Builder

Hello,

How to add space on a text on a single value?     Thank you for your help

Adding spaces did not have any affect. 
I was trying to align the text to the left

 

| makeresults
| eval test="this is a test                                       "
| table test

 

LearningGuy_0-1708981490265.png

If I added period,   it worked

 

| makeresults
| eval test="this is a test..........................."
| table test

 

LearningGuy_1-1708981526244.png

 

 

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

As @PickleRick points out, adding space does have effect.  The real question is: Where are you displaying these results?  It cannot possibly be from Splunk search.  This is what I see with the two values you illustrated.

| makeresults
| eval test="this is a test                                       "
| table test
| append
    [makeresults
| eval test="this is a test..........................."
| table test]
| eval length = len(test)

append spaces.png

As expected, both of them are aligned to the left. (Splunk search doesn't display right-aligned or center-aligned.)  If some external software cannot handle those trailing spaces, it's a problem with those software, not Splunk.

LearningGuy
Builder

@yuanliu 

I was trying to display on a single value panel as mentioned to the title.

I added your suggestion to Single value panel searches, the space didn't push the text to the left like the dot did.   Thanks

Please also see my response to @PickleRick 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

It does work. See for yourself.

| makeresults 
| eval f1="test"
| eval f1l=len(f1)
| eval f2="test "
| eval f2l=len(f2)

Maybe you have problems displaying the results in some specific way...

LearningGuy
Builder

Hello @PickleRick ,

I tried your solution, it did not display the space as you can see the grey dot is still on the center.
Note that I was trying to do it on a Single value Panel.  Please suggest. Thank you for your help.

LearningGuy_4-1709044490902.png

 

LearningGuy_3-1709044404832.png

If I used the dot, instead of spaces, it worked. See the grey dot is in the center

 

| makeresults 
| eval f1="test"
| eval f1l=len(f1)
| eval f2="test............"
| eval f2l=len(f2)
| table f2

 

LearningGuy_5-1709044886641.png

 

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Again - your problem is not with the value of the field but with the visualizaiton and the visual effect you want to achieve. The values are trimmed for displaying and it has nothing to do with values themselves. Also, formatting output with spaces is a no-no. We're not in the '80s anymore.

LearningGuy
Builder

Hello @PickleRick 

Understood. So, Splunk trimmed the space on purpose
My goal is to move the text to the left like it does on Splunk Dashboard Studio.
I applied CSS on the panel using "text-align: left", but it didn't work.     

Is it possible to align text to the left in a single value panel?
Thanks

LearningGuy_1-1709053041064.png

 

 

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

CSS would be probably the way I'd try to go for something like this but it might require more fiddling around that just simple align for the cell contents.

burwell
SplunkTrust
SplunkTrust

Try using printf

| makeresults
| eval test=printf(" %s","this is a test")
| table test
0 Karma

burwell
SplunkTrust
SplunkTrust

Sorry I misread this as wanting a leading space. Ignore my answer.

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...