Splunk Search

Adding and defining the value for a new Search Field.

Substance82
Path Finder

How do I add a  new field and set the value to seven days ago from the current date, snapped to the
beginning of the current date? I know the date syntax should be "earliest=-7d@d", but am unsure if I should use the eval command to add the field and the specific syntax. Thanks. 

Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

eval is the command to use to add a new field to an event.  Use the relative_time function to help set the value.

| eval newField = relative_time(now(), "-7d@d")

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

eval is the command to use to add a new field to an event.  Use the relative_time function to help set the value.

| eval newField = relative_time(now(), "-7d@d")

 

---
If this reply helps you, Karma would be appreciated.

Substance82
Path Finder

Thanks a million!

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...