Tag Archives: log

clog: Custom color for logs

I seem to be awash of colorizing programs as I chip away at the C section. This is clog, which the home page describes as a colorized log tail utility.

2014-08-01-lv-c5551-clog

That’s mostly true. It does colorize text and it does apply more to logs than straight text files. It lacks a feature or two that would make it a peer of tail.

Mostly, it lacks the ability to strain out the last lines of a log. By default, clog dumps everything to STDOUT, and ignores flags like -10 that are native to tail. A bit of a misnomer, then.

You have two options in your .clogrc file: either highlight an entire line, or highlight matching sequences of letters. (You can also suppress lines, which might be useful.) In that way you could use clog as a kind of stylized grep, and add a few more color options.

Some shortcomings: When you highlight a string of letters or a word, you will only see highlighting on the first occurrence. As far as I could tell, there was no way to highlight the same sequence multiple times in the same line. Several different colors on the same line will work, but only the first match for each color.

Furthermore, if you ask for full-line highlighting and the line matches more than one filter, you’ll only see one highlighting. I couldn’t make clog split highlighting. You can, however, highlight letter sequences overtop of line highlighting.

Those are shortcomings, but only if you’re trying to make clog behave like a strict color filter, and not a log colorizer. Think of clog like ccze, not like colout (or highlighter or pygments).

On the plus side, clog’s syntax for screening colors is terrifically simple. Step through the first three or four examples and you’ll have multicolor log displays in no time. And clog supplies date and time functions in case you want to stamp the output with either of those.

clog is a good tool, but not one I plan on adopting. I rarely peek at my logs anyway, and clog doesn’t handle enough grep-like colorizing to take over that role. If its abilities expand, I might consider it.

wtime: The laconic task tracker

Another console timekeeper for the W section: wtime. And this one is particularly closemouthed.

2014-06-30-6m47421-wtime

wtime has about six possible options: Start, stop, target a particular task (otherwise it uses “default”), show how many seconds have elapsed since the start, and sum the time spent on the task between a start and finish date.

Aside from that, wtime has very little to say for itself.

Now I know, that as a resourceful and enterprising young Linux devotee, you see a lot more potential in wtime than just something that spits out seconds since a start marker.

And I know you’ve already come up with a solution for translating wtime’s rather clunky output to a clean hours-minutes-seconds display.

No? You haven’t? You mean you want to see my suggestion? Okay, here’s one I’m borrowing, with a tiny adjustment, from Jaidu Saikia.

kmandla@6m47421: ~/downloads/wtime$ echo - | awk -v "S=$(./wtime -c)" '{printf "%d:%d:%d",S/(60*60),S%(60*60)/60,S%60}'
0:10:11

awk to the rescue, it seems. šŸ˜‰

If you hadn’t gleaned the info from the screenshot or the help pages, you can manage more than one task at a time. It does require you to prefix every command with the -t flag though, otherwise you’ll fall back to “default.” I see how and why this happens, but I’m sure there are better ways to handle it.

wtime is not in Arch/AUR or Debian. It’s a free-roaming program!

wtime doesn’t talk much, it’s a little cumbersome for multiple tasks and the output it gives is somewhat rudimentary. I don’t deny it works, but it has that exceptionally sparse feel, like a homework project or a tiny tool just for the author’s purposes.

With a little creativity you can get it going in a usable state, but with so many other options for time trackers and work logs, I have a feeling wtime will be quickly eclipsed. :\

worklog: Work on, work done, work sum, work today

Time-tracking software again, and this time it’s one that has been around for a while.

2014-06-29-6m47421-worklog

My first run-in with worklog was about four years ago, and it seems quite different now. Could it be that the project has changed hands, or the name has been juggled between authors?

I don’t know. I should mention though, that the web site I linked to four years ago has gone dead. Nothing to be read into that; it happens sometimes.

But worklog looks a bit different too. The screenshot I snapped way back then doesn’t look much like what I have on my screen now. I should mention that some of the options listed in the help pages trigger python errors.

Usually I would blame that on differences between python versions (those always seem to crop up among unmaintained software, whenever python gets a dot-bump) but this time it only makes me suspicious. (The python errors cropped up at work on --all for me, which I took to mean there would be some sort of interactive mode. That might be where that other screenshot came from. I honestly don’t remember. šŸ˜¦ )

worklog abbreviates itself to just work when installed, and it’s a simple matter of triggering a timer with work on Project to start, and work done when you’re … done. šŸ™„

Aside from that, you can ask for a breakdown of the work you’ve done today with work today and get a total sum of time spent with … you guessed it: work sum. There are a few other options for switching projects and editing descriptions, but if you can handle those four, you’ll do fine with worklog.

worklog is a decent choice if your time-tracking needs are simple, and neither timebook, timetrap nor punch is of interest. And if none of these is worthy of your attention, then may I suggest … ?

scanlogd: Nothing to see here

I’m a little behind the power curve today, after spending the day with some curious computer issues, which may or may not be related to hardware upgrades.

Also a curious issue: scanlogd. The curious part being, I am afraid I don’t have anything to show for it.

kmandla@j05sdg1 ~ $ sudo scanlogd
kmandla@j05sdg1 ~ $ 

If something beyond that is supposed to happen, I can’t see how it comes about.

I’ve been working with the Debian version, which installs and starts without issue, but doesn’t … really … seem to show anything for the (miniscule) effort involved.

I read through the man page, and maybe that lack of output is OK. It seems it shouldn’t really do anything unless someone attempts to scan ports on that machine — in which case it should just make a note of the attempt somewhere in /var/log.

Which is very very unlikely to happen, given that scanlogd is just wallowing around on my home network.

I will leave it to the more knowledgeable server managers to see if it is of any use. As for me, as a lowly desktop user, this doesn’t seem to have a function. šŸ˜¦

ccze: Colorize your logs, as an added step

Oh, the fun I must be missing by not caring to skim through my system logs.

2013-09-14-4dkln41-ccze

That’s ccze, and by comparison with some other log utilities, it’s a bit simplistic. Believe it or not.

That’s the Debian version you see there, skimming through the system logs. Arch has a version in community, which seems to work the same.

ccze has apparently been around a long time; the Freecode page shows the latest update in 2003.

If it has an official home page, somebody ought to tell both the Arch and Debian maintainers. The Arch page leads to the Freecode page above, and the Freecode page thinks the website is the Debian package search.

Things like that amuse me.

For what it’s worth — which isn’t much — I prefer lnav or multitail over ccze. My best success with ccze was to pipe a log through it, and then I got the color effects.

But ccze itself isn’t a pager, which means you either trim back on the log with head or tail, or use less or more, like you see above.

(If you want to use most, like me, because I’m cool, try use the -A switch with ccze to get raw ANSI output. Otherwise, the escape characters will be spattered all through the log text.)

That’s a bit high maintenance for me, particularly when lnav seems so featureful. And multitail is so much fun to use.

On the other hand, it does work like a colorizing filter. So maybe that’s the Unix solution. You can decide.

logtailer: Watching the logs in real time

I mentioned a couple of log utilities a long time ago, not least among them were multitail and lnav.

Here’s another, which you probably haven’t heard of: logtailer.

2013-08-11-v5-122p-logtailer

logtailer is a tiny little program that does only one small thing, and yet with that screenshot I can’t really show the utility of it.

See, logtailer just watches logs for updates, and spits the information on the screen.

Label and list as many logs as you like, and whenever an event occurs, it will pop up within logtailer, separated and labeled like you can see above.

Maybe that’s not the coolest thing you ever saw, but it’s remarkably simple and efficient. Very Unixy, if I can say that.

If you need to watch several logs at once but don’t have the resources for something like multitail, give this a try.