Naughty log watcher

From awesome
Jump to: navigation, search

Here's a log watcher implementation in pure Lua. It will show a naughty popup each time something changes in one of the predefined log files. The original code base on konius work and is refactored as a module and updated for newer version of awesome

1. Download luainotify from here: http://www3.telus.net/taj_khattra/luainotify.html

NOTE: On github there is Project with the same name. Don't use that one! The API is different.

Change in the source directory, make and install it to your lua path:

cd luanotify
make
install -D -s inotify.so /usr/lib/lua/5.1/inotify.so

On archlinux the library is avaible as a package in AUR

2. Clone or download the code into your awesome configuration directory

$ cd $XDG_CONFIG_HOME/awesome
$ git clone https://github.com/Mic92/lognotify.git

3. Load the module in your configuration:

require("lognotify")

4. Set some config variables (make sure the files are readable to you):

ilog = lognotify{
   logs = { mpd = { file = "/home/bob/.mpd/log", },
   	aptitude = { file = "/var/log/aptitude", },
   	-- Check, whether you have the permissions to read your log files!
   	-- You can fix this by configure syslog deamon in many case.
   	syslog    = { file = "/var/log/syslog", ignore = { "Changing fan level" },
   	},
   	awesome  = { file = "/home/bob/log/awesome",
   		ignore = {
   			"/var/lib/dpkg", -- aptwidget failure when aptitude running
   			"wicd", "wired profiles found", -- wicd junk
   			"seek to:", "Close unzip stream", -- gmpc junk
   			"^nolog"},
   		},
   -- Delay between checking in seconds. Default: 1
   interval = 1,
   -- Time in seconds after which popup expires. Set 0 for no timeout. Default: 0
   naughty_timeout = 15
}

5. Run it:

ilog:start()


That's it. Screenshots: http://omploader.org/vMW9jNw, http://omploader.org/vMW9reQ

Personal tools