Splunk Search

Can you help me with my string to date query?

serviceinfrastr
Explorer

Hi Community ,

I have a question about a conversion beetwen string to date.

I have some extract in CSV from my google platform like this :

> host=DSCRIPT02 sourcetype=csv:google | eval lastSync-mod=substr(lastSync,1,10)  | search "lastSync-mod"!=Never AND  "lastSync-mod"!=LastSync | table  resourceId email lastSync-mod | sort lastSync-mod | head 20

I have the last 20 mobiles, but i want the the list of mobiles that was not sync until 30days. The problem is the field last-Sync-Mod is not recognized as a date format

alt text

Can you help me 🙂 ?

Many thanks

Tags (2)
0 Karma

renjith_nair
Legend

@serviceinfrastructure,

Try

"Your search "|eval last_sync_time=strptime(lastSync-mod,"%Y-%m-%d")|eval diff=(now()-last_sync_time)/86400|where diff>30
---
What goes around comes around. If it helps, hit it with Karma 🙂
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!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...