Jahaja / psdash

A linux system information web dashboard using psutils and flask
Creative Commons Zero v1.0 Universal
2.42k stars 326 forks source link

warnings for dir entries under log paths (or: request for recursive log dir option?) #33

Closed jpotter closed 10 years ago

jpotter commented 10 years ago

Just updated to the latest version (it's been a while! nice updates! Works on OS X now!), and seeing this:

WARNING | psdash.log | Could not read log file "/mnt/service/logs/graphite" ([Errno 21] Is a directory: u'/mnt/service/logs/graphite')

Our log files are nested, and log files come and go (rotated out), so I start psdash with "--log /mnt/service/logs/* --log /mnt/service/logs// --log /mnt/service/logs///*". This gets us three levels, quite nicely.

Can the warnings for dir entries be ignored? Or maybe as a feature request, adding a --recurssive-log-dir option might be generally useful?

Thanks! -Jeff

Jahaja commented 10 years ago

Hi! Do you still get warnings if you use this pattern: /mnt/service/logs/**? It's the recursive version.

jpotter commented 10 years ago

Ahhhh. That makes so much more sense; wouldn't have thought of that. Thanks!

jpotter commented 10 years ago

Hi Joakim,

Actually, we're still getting the warnings. Using "_" finds all files -- which includes directory entries. We can't use something like _/*.log because we're handling many different services with various log file extensions that are unknown to our psdash instance.

So, maybe a simple: if not os.path.isdir(log_file) self.add_available(log_file) in log.py would avoid this? That'll work for the most part (unless log_file is a symlink to a dir...)

-Jeff

Jahaja commented 10 years ago

Ah, good find. I'll look into it.

Jahaja commented 10 years ago

Fixed by bfbba02e09cd5a8885b9308b4ef37de9349e8de9. Thanks for reporting!

jpotter commented 10 years ago

Thanks for the quick fix!