Are you a programmer or a system administrator? Does your job requires you to search through long and complex log files? Although there are many command line tools (like grep) that you can use for this purpose, if you are looking for a GUI based application, try Glogg. In this article, we will understand how to use this application
If you are an Ubuntu, Debain, Fedora, or Arch user, you can easily download the software using apt and yum. Ubuntu users can also use Software Centre to download and install the application with a few clicks. But if you are running some other Linux distribution, or want to download the source code, you can head over to glogg's official download page.
After you open the editor, the first step is to open a file, which you can easily do through File -> Open, or by clicking the folder icon present on the top left corner of the editor interface. Here is a screen shot of the editor in action:
To search a string or a keyword, enter that in the Text box and press Enter (or hit the Search button).
Separate Window For Results
One of the useful features of the editor is that it shows searched results in a separate window. For example, when I searched for the word 'drm', the editor produced the results in the following way:
Observe that the results were produced in a sub-window present at the bottom of the editor interface. So, this helps you to browse the results without deviating from the position you currently are in the log file. In case you want to see neighbouring lines of a line present in the result window, just double click it and the line will get highlighted in the main file (see screen shot below).
Supports Wildcard as well as Regular Expression Search
Aside from entering normal text, you can also use wildcards as well as regular expressions while searching in glogg.
As you can see in the screen shot shown above, I used the * wildcard to search for all the lines that contain words beginning with 'Linu', and glogg produced all these lines in the output.
While it's a good feature, you need to explicitly enable it through Tools->Options.
Similarly, you can also search text based on regular expressions, which the default search type, meaning you do not have to select it explicitly.
One of the other main features of the editor is that it lets you follow a file. This means that you can open a file (say a log file) in glogg and then track whatever is being written to it, all in real-time. In most of the cases, it helps you immediately zero down the set of logs that your application writes just when the error occurs.
To follow a file, open the file in question, and click View->Follow File.
Glogg also lets you create filters, wherein you specify a Matching Pattern along with background and foreground colours, allowing you to separately highlight lines containing certain keywords. This helps you track different keywords in the main window itself.
For example, I created the following two filters related to keywords 'drm' and 'Linux', specifying different color combinations for both:
Once both the filters were applied, here is how the main window looked like:
So you can see that lines containing Matching Patterns were highlighted in the colours specified in the respective filters.
Sometimes you do not want to search and collect a bunch of lines containing a keyword, all you want is to select a few lines and keep them aside in order to again have a look at them when you've gone through the complete log file. Glogg provides this functionality, which can be enabled by clicking the white circles that are present just before the lines in the main window.
For example, I inserted a couple of marks in the log file:
So you can see that the white circles for those two lines got converted into small blue arrows, and the line themselves appeared in the result window, making it easy for you to revisit them later.
Besides what all we've discussed till now, here is some more information about the log browser:
- Runs on Unix-like systems, Windows and Mac thanks to Qt
- Displays a context view of where in the log the lines of interest are
- Is fast and reads the file directly from disk, without loading it into memory
- Supports vim/less like keyboard commands to move around the file
- Is open source, released under the GPL
I'd recommend you to at least give glogg a try. I hope you won't be disappointed.