MongoDb connection URI

(Gianluca Valentini) #1

I need to save some data into Graylog MongoDB.
Can someone help me to understand how to recover the its uri (as in cluster as in signle configuration)?

I know that is present a key mongodb_uri on graylog.conf file, but I don’t know how to load it or if is present a default service to get it and its keys


(Jochen) #2

Please elaborate on what you want to achieve.

The credentials and connection details for MongoDB are configured in the mongodb_uri setting in the Graylog configuration file. So far so good, but I have no idea what you’re asking.

(Gianluca Valentini) #3

Hi @jochen
I try to explain what I want to do.
In order to implement my custom input (JDBC), I need to save the index/timestamp that reached.
So I thought to save them on Mongo (another collection I mean).

Here the idea to use the Greylog one.
I noticed the Java class MongoDbConfiguration in the Graylog server project but I do not know whether it’s my case.

Have you some suggestions for me to solve my problem?


(Jochen) #4

You can use MongoJack or use the PersistedImpl base class.

You can also inject MongoConnection in your class and work with the MongoDB Java driver directly.


(Gianluca Valentini) #5

Thanks a lot,
your solution is clear and efficient as always, by the way.


(system) closed #6

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.