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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...