Splunk Search

how to show a substr

dan_pudwell
Explorer

I am doing a substr and want to see that in a table, however it just gives no results

baseSearch | eval id = substr(detail.id,2,7)| table id

I would expect to see a table of id's that have been substringed, however I get no results found?

1 Solution

javiergn
Super Champion

Try with quotes:

baseSearch | eval id = substr("detail.id",2,7)| table id

View solution in original post

javiergn
Super Champion

Try with quotes:

baseSearch | eval id = substr("detail.id",2,7)| table id

dan_pudwell
Explorer

I just figured this out and went to add my own answer!
single quotes work as well

0 Karma

sumeet20rani
New Member

Hi,
I have DB field which has value like -
DB = arn:aws:rds:eu-west-1:354706231380:db:we1abcdeslfwtya
I want to print we1abcdeslfwtya
And below is my query -
| rename results{}.total_amortized_cost as Total_amor , results{}.resource_identifier as DB | eval n=substr(DB,15) | table DB , n
However, I get the n column in table as blank. I dont know whats wrong happening here. I tried with double quotes ( " ) and single quotes ( ' ) both for DB and it doesn't work. Like substr("DB",15)
Can someone help please.
Thanks in advance
Regards,
Sumeet

0 Karma

woodcock
Esteemed Legend

So will dollar-signs.

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!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...