Getting Data In

How to transform a field into a new field using the old field as part of a string in the new field

user93
Communicator

I have a list of IDs in a report using a lookup. I want to deliver the report using the IDs to create a URL.

id=abcd1234

Transform field and write new filed to the lookup table

url=https://www.domain.com/go/

|inputlookup basetable
|search value=WhatIsBeingReported
|table id,title,url

0 Karma
1 Solution

acfecondo75
Path Finder

Hi again @user93!

you can concatenate field values and strings together using an eval statement. Then you can add that field to the lookup by piping the results to an outputlookup command. Try something along the lines of

| inputlookup yourlookup
| eval url="https://www.domain.com/go/".id
| table id, title, url
| outputlookup yourlookup

View solution in original post

acfecondo75
Path Finder

Hi again @user93!

you can concatenate field values and strings together using an eval statement. Then you can add that field to the lookup by piping the results to an outputlookup command. Try something along the lines of

| inputlookup yourlookup
| eval url="https://www.domain.com/go/".id
| table id, title, url
| outputlookup yourlookup

user93
Communicator

Hey again @acfecondo75 !

So, that didn't quite work for me because my field has a space in it. I want to use the value of the id field where the filed name is "page id"

I have

|inputlookup table.csv
|search field=value

|eval created_epoch=strptime(Created,"%m/%d/%Y %H:%M")
|eval time_diff=now()-created_epoch

|eval url="https://www.domain.com/go/"."Page Id"

|table "Page Id",title,url,created_epoch,time_diff

|search time_diff<=2592000

My results show https://www.domain.com/go/Page Id. I want the value of the page id, so like https://www.domain.com/go/abcd1234

0 Karma

acfecondo75
Path Finder

if you need to reference a field with a space in it inside an eval statement, wrap the field name in single quotes to indicate that it's a field.

0 Karma

acfecondo75
Path Finder

you could also wrap it in $s. 'Page Id' or $Page Id$ will work.

0 Karma

user93
Communicator

Brilliant! I chose the money sign 🙂

Thanks again

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!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...