mongotail icon indicating copy to clipboard operation
mongotail copied to clipboard

`mongotail [db] --follow` exits after 1 second

Open kevinburke opened this issue 7 years ago • 7 comments

I installed the tool and am running mongotail [db] --follow. I expect that the command will block until I kill it with ctrl+c. Instead, it exits after 1 second, without printing anything.

It would be good if it warned that you needed to run with --level=2, if --level=2 was the default mode, or otherwise displayed a warning or error, instead of exiting without displaying any messages.

kevinburke avatar Aug 29 '17 17:08 kevinburke

Running mongotail accounts --level=1 -f sets the level and then exits. I expect that it would set the level, and then start following the database.

All of these make it difficult to script mongotail, or to explain how to others to use it; I'm looking for something that can immediately start tailing the database logs.

kevinburke avatar Aug 29 '17 17:08 kevinburke

@kevinburke You are right. It would be a good improvements, and the last behavior is a bug actually. I'll try to implement the changes, but it will not be soon. Patchs are welcome :)

mrsarm avatar Aug 29 '17 18:08 mrsarm

It always just exits for me. I can't get it to work.

ghost avatar Jul 23 '18 22:07 ghost

FWIW, I implemented a tool that has the behavior I want, https://github.com/kevinburke/read-mongo-logs

kevinburke avatar Jul 23 '18 22:07 kevinburke

@errorx666 did you solve the issue?

Did you activate first the profiler with the -l option?

Mongotail has the same syntax to connect to a database that the command mongo provided by any MongoDB distribution, did you try to connect within the same console to the database with the same params but using the mongo command?

For instance, if you are executing mongotail myhost/mydatabase, you can try the same but using mongo command like this: mongo myhost/mydatabase. If you cannot connect to the database using this command, it's a connection issue. Try also connect with mongotail using the --verbose option.

mrsarm avatar Jul 24 '18 18:07 mrsarm

@errorx666 indeed, it did not work for me either. verbose did not do the trick either. connection confirmed.

serkandemirel0420 avatar Apr 02 '19 19:04 serkandemirel0420

@errorx666 ,

Lets say you try to connect with your database with:

$ mongotail hostname/mydb -l 2
$ mongotail hostname/mydb -f

Can you try in the same machine execute:

$ mongo hostname/mydb

(note that you have to make the test in the same machine, using the same connection string, in the example hostname/mydb, but using the MongoDB mongo CLI)

mrsarm avatar Apr 02 '19 19:04 mrsarm