Quick lookup of SMF log file

July 13th, 2012 | Categories: Solaris, Technology

As mentioned in my previous Solaris related post, I’ve recently started using Solaris.

What I didn’t mention is that I briefly use Oracle Solaris 11 11/11, but quickly went to OpenIndiana. I personally did not like the way Oracle is doing things. Plus the added benefit of KVM and some extra goodies here and there.

I will now show you one of the neat things that will probably never make it into Oracle Solaris.

svcs -L

This little switch for svcs[1] will print the logs for each service. Normally you need to use -x to then manually extract the path from the output.

Say you want to view the log for the build in SMB server, all you need to do on a Illumos based distribution is the following.

less `svcs -L smb/server`

This you can drive this further (get the 10 most recent touched log files, including the ones from zones):

ls -tal `svcs -LZ` | head -10

To quote Bryan M. Cantrill “Small tools doing well defined things.”, this is why I love UNIX.[2]

If you didn’t know about this already, you will love this! If you did know about it, you already love this!

Comments are closed.