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
SplunkTrust
SplunkTrust

@serviceinfrastructure,

Try

"Your search "|eval last_sync_time=strptime(lastSync-mod,"%Y-%m-%d")|eval diff=(now()-last_sync_time)/86400|where diff>30
Happy Splunking!
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...