Getting Data In

How to convert the MongoDB ISO date to Normal date format in HUnk

rkanumula
Path Finder

Hi,
Can you please share How to convert mongodb ISO date into Normal date format in Hunk . I am getting the date format as "1426185748" but i want the output format as "YYYY-MM-DD"

Thanks in advance

rdagan_splunk
Splunk Employee
Splunk Employee

In my case I added the format = date to the indexes.conf file under /hunk/etc/apps/search/local
That flag will extract ISODate and you should be able to see a JSON format and _timestamp field in the Hunk UI
For example,
[mongodb_movie_rating]
vix.mongodb.collection = movieratings
vix.mongodb.db = raanan
vix.mongodb.field.time = ts
vix.mongodb.field.time.format = date
vix.provider = local-mongodb

After the extraction you can also add more flags in the props.conf. For example, in my case I also have
[movieratings]
MAX_DAYS_AGO = 123456789
TIME_FORMAT = %s
TIME_PREFIX = _timestamp" :

0 Karma

rdagan_splunk
Splunk Employee
Splunk Employee

Can you share your indexes.conf file that includes all the configurations?
There is no props.conf out of the box. You will need to create it.

Look for an example props.conf In this thread
http://answers.splunk.com/answers/225427/how-to-get-hunk-to-parse-the-date-properly-in-my-s.html

In my example, ts is the field + date is the format:
db.movieratings.find()
{ "_id" : ObjectId("5388e41c12569b70c376e9fb"), "userid" : 1, "movieid" : 122, "ts" : ISODate("1996-08-02T11:24:06Z"), "rating" : 5 }
{ "_id" : ObjectId("5388e41c12569b70c376e9fc"), "userid" : 1, "movieid" : 185, "ts" : ISODate("1996-08-02T10:58:45Z"), "rating" : 5 }

0 Karma

rkanumula
Path Finder

Hi rdagan_splunk,

Thanks for giving me the reply

i given all the settings in the MongoDB Virtual index but still i am facing the same and also i have searched the prop.conf file contains Mongo DB Collection name but i didn't find the prop.conf file. Can u please share me the Path of that prop.conf (which contains the Mongo DB collection information)

Thanks in Advance

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...