mongodb-labs / edda

A log visualizer for MongoDB - This Repository is NOT a supported MongoDB product
232 stars 28 forks source link

Error "not authorized for query on" #134

Closed phumberdroz closed 8 years ago

phumberdroz commented 9 years ago

python edda/run_edda.py /var/log/mongodb/mongod.log Traceback (most recent call last): File "edda/run_edda.py", line 372, in main() File "edda/run_edda.py", line 139, in main process_log(logs, servers, entries, config) File "edda/run_edda.py", line 209, in process_log server_num = get_server_num("unknown", False, servers) File "/root/edda-master/edda/supporting_methods.py", line 116, in get_server_num if not servers.find_one({"server_num": str(i)}): File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py", line 724, in find_one for result in cursor.limit(-1): File "/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py", line 1058, in next if len(self.data) or self._refresh(): File "/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py", line 1002, in _refresh self.uuid_subtype)) File "/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py", line 940, in __send_message self.__compile_re) File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line 109, in _unpack_response error_object) pymongo.errors.OperationFailure: database error: not authorized for query on edda.54abc814987b1809d3ad2173.servers

Am I doing something wrong ?

samantharitter commented 9 years ago

Hi @meat147, can you please tell me what version of mongod your logs are from, and what version of mongod you're running edda with? Also, are you running your mongod with --auth?

volans- commented 9 years ago

@samantharitter I'm having the same issue with

security:
    authorization: enabled

in the MongoDB config file. Disabling it edda runs without exceptions.

There is a way to specify a MongoDB connection string or the auth parameters? From the help apparently there is no such option.

samantharitter commented 9 years ago

@volans- that's correct, there is currently only support in edda for a limited subset of MongoDB connection string options. I've opened an issue to track development for that feature, but as this project isn't really under active development I can't give you a timeline for when it will be added.

There's really no workaround for this other than to run mongod without --auth. To clarify, the mongod you run while you run edda must not have authentication enabled. The logs that you feed to edda can be from mongod instances that were authenticated, there should be no issues with that.

volans- commented 9 years ago

@samantharitter thanks for the quick reply, I have one more question: the mongod towards which I run edda needs to be to be part of the replicaSet from which I got the logs, is that right?

Because in a typical case of for example a production cluster I surely can't disable the auth so I would like to know if it will work grabbing the logs and be able to run edda on them in some way.

samantharitter commented 9 years ago

@volans- no, you can use edda with any mongod, it doesn't have to be the same server or replica set that generated the logs. I would recommend that you spin up a local mongod without auth, and feed it the logs from your replica set in production. Edda just needs access to a mongod so it can store information as it's processing.

volans- commented 9 years ago

@samantharitter that's great, I've git it a quick try and i got CRITICAL:edda.run_edda:No servers were found, exiting. I've passed a 27MB MongoDB log file. If you want we could move the discussion on another issue if you don't want to go off topic.

samantharitter commented 9 years ago

That's fine, we can debug here, it might be useful to somebody else.

Can you tell please me:

volans- commented 9 years ago
samantharitter commented 9 years ago

Version 0.7.0 of edda doesn't work with MongoDB logs past version 2.4. To run edda against logs from 2.6 or 3.0 servers, you'll have to pull the code here from the master branch, and run using that. The current work hasn't yet been published to PyPi as a new release, so you can't pip install a version that will work with logs from new mongods.

Let me know if you are able to clone the repository and run against your logs.

samantharitter commented 9 years ago

I've added a note about this to the readme, other people have also run into the same issue!

volans- commented 9 years ago

Thanks a lot for live support! Yes with a:

git clone https://github.com/10gen-labs/edda.git
python edda/edda/run_edda.py FILENAME

I was able to run it. The browser page is a bit empty compared with running it with one of the sample logs, but maybe is just missing information. I'll try to grab all the logs and run it over them.

samantharitter commented 9 years ago

Awesome. Keep in mind that the sample logs were generated to purposefully show interesting things (nodes go down often, elections happen, etc.). It might just be that your logs are from a much more stable cluster :)