I am looking for a solution to transfer logs from Splunk and store them in MongoDB, can anyone suggest me?
You can use Splunk DB Connect. It's a great tool designed specifically for that use case.
https://splunkbase.splunk.com/app/2686/