Olav
Olav

Reputation: 1784

How to work with logfiles

Usually I pipe my log through a lot of greps to remove the "noise" before i open it in an editor.

I think it should be possible to do this filtering inside an editor (Especially Emacs)

Is this what chainsaw is doing? For log4j format only or more general? (It is the only logfile viewer tool I can find)

How do you guys do it? (I think UNIX grep syntax would be easiest for me)

Upvotes: 0

Views: 464

Answers (4)

user319799
user319799

Reputation:

Necroposting: I created a mode for Emacs that is specifically targeted at Log4j-like logs, but supports many more formats, especially if you customize it for yourself.

Features:

  • Colorization (just customize faces if that's too much)
  • Interactive filtering in the same buffer:
    • by level
    • by logger name
    • by thread
    • by message
    • easy narrowing
    • edit all currently set filters at once
  • A few log-specific movement commands
  • Copy (with M-w) only visible text, goes well with filtering (this is customizable)

Upvotes: 0

karthi
karthi

Reputation: 1455

Yes, you should try Chainsaw first.. it does support various ways of getting your logs.

Upvotes: 0

Scott
Scott

Reputation: 1736

Chainsaw does support both positive and negative filter matching. You can define positive and negative matches based on the logger tree (right click on nodes for the options), and you can define positive-match expressions in the 'refine focus' field, and negative-match expressions using the 'ignore' option below the logger tree. There is a tutorial available from the help menu which describes the expression syntax.

Chainsaw has had a lot of new features added since the last official release. The developer snapshot (including a reworked configuration screen) is available here:

http://people.apache.org/~sdeboy

Chainsaw doesn't just work with log4j. There are 'receivers' available that make it work with log4net, java.util.logging, log4php and others.

You can also process any regularly formatted text file using a VFSLogFilePatternReceiver (use the 'process a log file' option to configure Chainsaw to define one). There are some pre-defined log formats in the configuration dialog that act as example formats - tweak one to match your format. The JavaDoc provides more information: http://logging.apache.org/chainsaw/apidocs/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.html

Upvotes: 1

Lars
Lars

Reputation: 5799

If the greps are the same, you can simply code a script to do all that work for you (e.g. vimscript for vi). That way, you don't have to repeat all the tasks while leaving the logs intact for further investigation.

You're right on chainsaw and log4j - it's a logging viewer with different capabilities, e.g. a filter mechanism. However, I am unsure, if you are able to have multiple filters activated simultaneously.

Upvotes: 0

Related Questions