# LOGFOO Filter and format logfiles on command line ## build * LUA required ;) ``` gcc -I/usr/include/lua5.4 -g logfoo.c -llua5.4 -o logfoo ``` ## usage ``` logfoo ``` ### lua * the lua needs 2 methods * `function filter (line)` returns boolean; true -> don't print line * `function format (line)` returns string * example: ```lua function filter (line) -- only lines containing text "Unknown kernel..." return line:find("Unknown kernel command line parameters") == nil end function format (line) -- red, bold, underline text "IMAGE" line = line:gsub("(IMAGE)", color("%1", "31;1;4")) -- green text "gentoo" line = line:gsub("(gentoo)", color("%1", "32")) -- only text between " return line:match("\"([^\"]+)\"") end ```