Getting Command History from Node Vol0 Snapshots

Back in August 2014 I wrote the two parter - Command History to Syslog for CDOT Version 2. This was a workaround to have functioning Command History to Syslog from Clustered ONTAP version 8.2.X. But what if you couldn’t use the workaround for whatever reason?

If we want 60 days’ worth of command history, and seeing as 8.2.X seems to keep 30 days’ worth of command-history on the active file-system of the node(s) vol0, we can simply set a vol0 snap sched of 30 days.

CLUS::> node run -node * snap sched vol0 0 30 0

But how do we get to the snapshots of the node’s vol0 to read the logs?

CLUS::> set -privilege diagnostic
CLUS::*> security login unlock -username diag
CLUS::*> security login password -username diag
CLUS::*> systemshell NODE01

... log in with username diag ...

NODE01% cd /mroot/etc/mlog/.snapshot

... and list the available snapshots ...

NODE01% ls

... change directory to a snapshot of interest ...

NODE01% cd daily.55

... list the command-history files ...

NODE01% ls command-history.*

... then you can read the file in whatever FreeBSD UNIX-y way you like, e.g.:

NODE01% cat command-history.log.0000012345

When done:

NODE01% exit
CLUS::*> security login lock -username diag
CLUS::*> set -privilege admin

Comments