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
If I added period, it worked
| makeresults
| eval test="this is a test..........................."
| table test
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)
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.
@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
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...
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.
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
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.
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
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.
Try using printf
| makeresults
| eval test=printf(" %s","this is a test")
| table test
Sorry I misread this as wanting a leading space. Ignore my answer.