freopen
Action
void freopen(string pathname) void freopen(string format, ...)
The freopen
action changes the standard output file to the file specified by pathname argument. This action is potentially destructive and needs to be activated by the -w
destructive option.
"dispatch_command": #!/usr/sbin/dtrace -qw #pragma D option strsize=1024 dtrace:::BEGIN { freopen("/tmp/sqls"); } pid$target::*dispatch_command*:entry { printf("%Y-> %s \n",walltimestamp,copyinstr(arg2)); }
which gives logs like:
2009 Feb 5 08:13:43- > create table fo_bawr (i INTEGER) 2009 Feb 5 08:13:56- > create table foo_bar (is INTEGER)