Splunk Search

Date Field calculations help

saurabhkunte
Path Finder

Hello All,
I am hoping one of you can help me out with the following:
I have a Powershell script which is displaying the output of all Active Directory Server objects and indexing to Splunk which works well. The output is getting indexed in the following format:
output :

2014/04/29 11:46:39 ServerName="am-dc02" ADSPath="CN=am-dc02,OU=Domain Controllers,DC=ads,DC=contoso,DC=com" Created="04/28/2014 12:34:36"
2014/04/29 11:46:39 ServerName="am-dc01" ADSPath="CN=am-dc01,OU=Domain Controllers,DC=ads,DC=contoso,DC=com" Created="04/28/2014 12:34:01"

this script runs everyday and indexes the ad export list to splunk.

What i want to achieve is to have a report setup to list all new AD objects that got created Current Date -1 day, Current Date - 7 days. i can use the " Created" date field to calculate this. However when I try to convert this field to epoch time and then compare it against timenow, I do not get any results. Can any body provide me with the correct query on how to achieve these reports ?

Thank you.
S

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try this

your base search | eval report_cutoff=relative_time(now(),"-1d") | convert timeformat="%m/%d/%Y %H:%M:%S" mktime(Created) | where Created > report_cutoff

View solution in original post

somesoni2
Revered Legend

Try this

your base search | eval report_cutoff=relative_time(now(),"-1d") | convert timeformat="%m/%d/%Y %H:%M:%S" mktime(Created) | where Created > report_cutoff

saurabhkunte
Path Finder

ah correct. perfect that works well. Thanks for your quick help. Appreciate it !

0 Karma

somesoni2
Revered Legend

-1d goes back exactly 24 hrs back (e.g if its 4/29 2 PM now, then it goes back to 4/28 2 PM). Change it to -1d@d to see AD groups created since Yesterday Midnight (4/28 12 AM)

saurabhkunte
Path Finder

Thanks for your reply.
This returns no results and I know for sure i had the above 2 AD objects created yesterday and listed under Created Field. Any other ideas please ?

0 Karma
Get Updates on the Splunk Community!

Splunk Platform | Upgrading your Splunk Deployment to Python 3.9

Splunk initially announced the removal of Python 2 during the release of Splunk Enterprise 8.0.0, aiming to ...

From Product Design to User Insights: Boosting App Developer Identity on Splunkbase

co-authored by Yiyun Zhu & Dan Hosaka Engaging with the Community at .conf24 At .conf24, we revitalized the ...

Detect and Resolve Issues in a Kubernetes Environment

We’ve gone through common problems one can encounter in a Kubernetes environment, their impacts, and the ...