/usr/sbin/dtrace -q -Z -32 -n ' /* # Program: Print response codes # # Author: Matty # # Current Version: 0.1a # # Revision History: # Version 0.1a # # Last Updated: 11-25-2005 # # Purpose: Prints the aggregate values of response codes. # # Installation: # Copy the shell script to a suitable location # # CDDL HEADER START # The contents of this file are subject to the terms of the # Common Development and Distribution License, Version 1.0 only # (the "License"). You may not use this file except in compliance # with the License. # # You can obtain a copy of the license at Docs/cddl1.txt # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # CDDL HEADER END # # Example: # $ responsecodes.d # Sampling response code data (Ctrl-C to stop): # Response Code Count # 404 4 # 200 22 # # */ dtrace:::BEGIN { printf("Sampling response code data (Ctrl-C to stop and print):\n"); } ::apache_log_request:log-request { this->responsecode = (int)*(uintptr_t *)copyin(arg0 + 68,sizeof(int)); @responsecodes[this->responsecode] = count(); } dtrace:::END { printf("Response Code Count\n"); printa("%-13d %-@19d\n",@responsecodes); trunc(@responsecodes); }'