printing time
Kendrick, Stuart
Stuart.Kendrick at emc.com
Thu Aug 28 15:17:59 UTC 2014
How else might I print a timestamp, other than using ‘printf … walltimestamp’?
I’m running dtrace on a platform (modified version of FreeBSD 7) where ‘printf %Y’ only ever returns the one timestamp: 1969 Dec 31 18:00:00
So I’m casting around for another approach: suggestions?
My script ‘watch-file.d’:
# pragma D option quiet
BEGIN
{
printf("\n Timestamp gid uid pid ppid execname function\n\n");
}
syscall::open*:entry, syscall::unlink:entry, syscall::rename:entry
/strstr(stringof(copyinstr(arg0)), $1) != NULL/
{
printf("%Y %5d %5d %5d %5d %-12s %-10s %s\n",
walltimestamp, gid, uid, pid, ppid, execname, probefunc, stringof(copyinstr(arg0)));
}
Typically run as follows:
./watch-file.d ‘“/etc/foo”’ | tee /var/tmp/foo.log
where /etc/foo is the file I want to watch — i.e. something is updating this file at awkward moments, and I want to identify what process does this.
[...]
1969 Dec 31 18:00:00 0 0 2739 1 isi_rpc_d open /etc/ifs/local.xml
1969 Dec 31 18:00:00 0 0 2739 1 isi_rpc_d open /etc/ifs/local.xml
1969 Dec 31 18:00:00 0 0 2739 1 isi_rpc_d open /etc/ifs/local.xml
1969 Dec 31 18:00:00 0 0 3131 1 isi_celog_monitor open /etc/ifs/local.xml
1969 Dec 31 18:00:00 0 0 3131 1 isi_celog_monitor open /etc/ifs/local.xml
1969 Dec 31 18:00:00 0 0 3131 1 isi_celog_monitor open /etc/ifs/local.xml
1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /etc/ifs/local.xml
1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /etc/ifs/local.xml
1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /etc/ifs/local.xml
1969 Dec 31 18:00:00 0 0 3099 1 isi_celog_coalescer open /etc/ifs/local.xml
~
—sk
Stuart Kendrick
EMC Isilon
More information about the freebsd-dtrace
mailing list