Splunk Search

Can i have field names with spaces ?

rakesh_498115
Motivator

Hi ,

Can I have the fieldnames with spaces . i.e I have used the rename command in my search Query as follows..

my search ..| rename Prod_id as Product Details

This is throwing error..How can i use the rename command or is there any way to rename the fields with spaces included in the middle as shown above..

Please help..Thanks.

1 Solution

sdaniels
Splunk Employee
Splunk Employee

yes, you just need double quotes around the name.

... | rename Prod_id as "Product Details"

View solution in original post

luthfi49
Explorer

But I cannot calculate that field with space by eval command..
How can I calculate field with name containing space ?

0 Karma

rakesh_498115
Motivator

hi luthfi49,

for fields name with space , you can use in eval statement using single quote notation.

i.e. for example :

1) eval 'Product Details' = 'Product Details' + " Field "

2) eval 'user count' = 'user count' * 20

where "user count" is the field name.

thanks,
Rakesh.

grijhwani
Motivator

You don't. You leave the field name conversion until presentation time.

sdaniels
Splunk Employee
Splunk Employee

yes, you just need double quotes around the name.

... | rename Prod_id as "Product Details"
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...