Trim chatty command outputs
version 0.03
# Run spammy_command and log its output, but weed out some output prolix -b '(spam)' -l auto -- spammy_command cmd_opt1 cmd_opt2 # While it's running, hit enter and add another ignore term at the # interactive prompt prolix> ignore_substring (more spam) # Weed uninteresting fields out of a log file. # Pipe mode is not interactive; but it accepts the same filtering # arguments as the full interactive mode. tail -f error.log | prolix -s 's/^\[(.*?\] ){3}//'
prolix launches a command and captures its standard output and error. It suppresses uninteresting lines. Unlike \*(C`grep -v\*(C', it is an interactive program; hit enter to add suppression patterns as new anoyances come up on your terminal. You can weed out by full or substring line matches, as well as regexp. You can also apply substitutions to lines, for example shorten overly chatty fields.
prolix can be configured to automatically store a filtered log of output from the commands that it captures.
When running in a pipeline, prolix can't interact with you, but it does accept the same command line parameters, so it acts like a replacement for \*(C`sed\*(C', \*(C`grep -v\*(C', and \*(C`grep -E -v\*(C'.
[Planned] You can have prolix remember different profiles for different command invocations, so that if you often debug a server, prolix (which knows your command line) will identify what ignore/snippet patterns to apply to it.
Normally you will run prolix with:
prolix [PROLIX OPTIONS] -- somecommand [COMMAND OPTIONS]
You can also put prolix in a pipeline.
somecommand | prolix [PROLIX OPTIONS]
When specified, \*(C`prolix\*(C' will add some output of its own, for example saying it's in pipe mode.
Force pipe mode.
Log filtered output to \s-1FILENAME\s0. If the argument looks like a pathname (contains a \*(L"/\*(R"), we'll use that. Otherwise, the output will go to the temporary directory (as defined by File::Spec->tmpdir). The special value \*(L"auto\*(R" lets prolix pick a filename based on the command being run. The substring \*(L"%d\*(R" is expanded to a timestamp in a path-friendly variation of iso8601. More substitutions may be added in the future.
Ignore files matching \s-1REGEXP\s0. This is case-sensitive; use \*(C`(?i:...)\*(C' to ignore case. (-i may be added in the future.)
Ignore complete matches on \s-1LINE\s0.
Ignore lines containing \s-1SUBSTRING\s0.
Transform lines by applying a Perl substitution on them. Useful, for example, in getting rid of uninteresting fields in a logfile. Here, modifiers \*(C`/i\*(C', \*(C`/g\*(C', and \*(C`/x\*(C' are honored. You can also use alternate delimiters instead of \*(C`/\*(C', including balanced ones (\*(C`s{a}{b}\*(C'.) We'll add facilities for doing this in a more convenient way for structured lines in future versions. (For example, \s-1CSV\s0 or Apache \s-1CLF\s0.)
When \*(C`prolix\*(C' launches a program itself (as opposed to pipe mode), pressing enter pauses the display of output from the program, and you're dropped into a prompt. Here you can add more patterns to ignore or apply new snippetting rules. These will take effect on subsequent output. Blank input returns you to the normal running of the command.
The interactive mode has a \*(L"help\*(R" command listing available commands. Those that add new filters follow the long command line options. So for example, saying \*(L"ignore_substring temptation\*(R" will ignore all lines containing \*(L"temptation\*(R".
You can also say \*(L"pats\*(R" to list all patterns in effect, and \*(L"clear_all\*(R" to remove them. (Removing a particular rule is not supported but we can add it if it is requested.)
You can find documentation for this module with the perldoc command.
perldoc App::Prolix
You can also contact the maintainer at the address above or look for information at:
AnnoCPAN: Annotated \s-1CPAN\s0 documentation http://annocpan.org/dist/App-Prolix/ <http://annocpan.org/dist/App-Prolix/>
\s-1CPAN\s0 Ratings http://cpanratings.perl.org/d/App-Prolix/ <http://cpanratings.perl.org/d/App-Prolix/>
\s-1RT:\s0 \s-1CPAN\s0's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-Prolix <http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-Prolix>
Search \s-1CPAN\s0 http://search.cpan.org/dist/App-Prolix/ <http://search.cpan.org/dist/App-Prolix/>
Source repository https://github.com/gaal/app-prolix <https://github.com/gaal/app-prolix>
Gaal Yahas <[email protected]>
This software is Copyright (c) 2012 by Google, Inc.
This is free software, licensed under:
The MIT (X11) License