Date: Thu, 28 Aug 2014 10:52:54 -0400 From: "Kendrick, Stuart" <Stuart.Kendrick@emc.com> To: "freebsd-dtrace@freebsd.org" <freebsd-dtrace@freebsd.org> Subject: printing time Message-ID: <D0249056.15458%stuart.kendrick@emc.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D0249056.15458%stuart.kendrick>
