Splunk Search

Help adding pipe "l" for all results

kc_prane
Path Finder

Hello  - I am getting the below error. I am trying to add pipe "|"  for all the results.

 Error : Failed to parse templatized search for field 'ResponseTime(ms)'

My search :

 | table PeriodDate VendorName ContractName OccMetricCode Pagekey TransactionType TransactionDatetime ResponseTime(ms) Comment
| foreach * [ eval <<FIELD>>="|".<<FIELD>>."|"] 

 

I am not getting pipe seperated results only for ResponseTime

PeriodDate 

ResponseTime(ms) 

Comment 

|2022/08/30|

0

||

 

Thanks in advance

 

Labels (1)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| table PeriodDate VendorName ContractName OccMetricCode Pagekey TransactionType TransactionDatetime ResponseTime(ms) Comment
| foreach * [ eval "<<FIELD>>"="|".'<<FIELD>>'."|"] 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

To add to @ITWhisperer reply. When handling field names that start with numbers, or contain 'odd' characters, e. g. in this case the brackets, (), you need to use single quote characters on the right hand side of eval. It's always sensible, particularly when using foreach, to DOUBLE quote the left hand side of the eval, i.e. 

| eval "QUOTED NAME"='Quoted(ms) field'

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| table PeriodDate VendorName ContractName OccMetricCode Pagekey TransactionType TransactionDatetime ResponseTime(ms) Comment
| foreach * [ eval "<<FIELD>>"="|".'<<FIELD>>'."|"] 

kc_prane
Path Finder

Thanks @ITWhisperer

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...