Skip to main content

Pobieranie dużej ilości logów mongoExport

Maxime avatar
Written by Maxime
Updated over 4 months ago

Sytuacja kiedy robo się zawiesza i wyłącza podczas pobierania logów - należy użyć komendy mongoexport w command line na serwerze, gdzie stoi mongo (mongotoolsy byly/sa czescia pakietu mongo serwera)

docker exec -i ID_MONGO_CONTAINER mongoexport --username user --password pass --authenticationDatabase admin --db Consent --collection Consent --fields status,isDeleted,userId,bankSwiftCode,aspspAccountId,confirmed,registered,created,authorized,variables -q '{ isDeleted: false}' --out /PATH/consents.json

Pogrubione wartości należy uzupełnić
ID_MONGO_CONTAINER – id kontenera, na ktorym jest mongo
user, pass – pasy do konta, ktorym logujecie sie do Robo3T
/PATH/consents.json – gdzie zapisac wynik – WAZNE zeby byl w jsonie

Query do zapytań z datami (potrzebny jest extended json):
docker exec -i ID_MONGO_CONTAINER mongoexport --username user --password pass --authenticationDatabase admin --db NLog --collection Log_20210614 -q '{ "date":{"$gte":{"$date":"2021-06-14T21:00:00.000Z"},"$lt":{"$date":"2021-06-14T21:59:59.000Z"}},"logger": {"$in": ["LogCommand", "LogQuery", "LogRequest"]} }' --out /PATH/consents.json

Did this answer your question?