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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...