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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...