Analyzing Apache Log Files

List Client IP and Count Hits

awk -F'[ “]+’ ‘$7 == “/” { ipcount[$1]++ } END { for (i in ipcount) { printf “%15s – %d\n”, i, ipcount[i] } }’ access.log

 

List Client IP and RDNS

cat access.log | awk ‘{print $1}’ | logresolve

How to Determine Database Role Permissions

This SQL statement will show all the permissions of a particular role:

use YourDBName

go

 

select dp.NAME AS principal_name,dp.type_desc AS principal_type_desc,

o.NAME AS object_name,p.permission_name,p.state_desc AS permission_state_desc

from sys.database_permissions p

left OUTER JOIN sys.all_objects o

on p.major_id = o.OBJECT_ID

inner JOIN sys.database_principals dp

on p.grantee_principal_id = dp.principal_id

where dp.NAME=’YourDBRoleName’

 

Thanks to Mike Warner

Explanation of Classic vs. Integrated mode in IIS 7.x

Classic mode is where IIS only works with ISAPI extensions and ISAPI filters directly. This is how IIS 6 and below behaved. Using classic mode, ASP.NET is simply an ISAPI extension (aspnet_isapi.dll) and an ISAPI filter (aspnet_filter.dll). When using classic mode the server uses two piplines to handle requests, one for native code and the other for managed code. In this mode the application doesn’t take full advantage of everything IIS 7.X has to offer.
Integrated mode handles all requests through a unified pipeline for IIS and is tightly integrated with ASP.NET through that same pipeline. ASP.NET sees every relevant request and manipulates things along the way rather than acting as an external plugin. With integrated mode ASP.NET runs much more efficiently in IIS and will yield greater performance for your site.

 

Some legacy code may require that you run in classic mode to execute without error. To take full advantage of IIS we strongly encourage you to review your code if your application throws an error in Integrated but runs fine in Classic.

Installing packages in Ubuntu from cdrom (no Internet)

In many cases, the dev class vm’s do not have Internet access (annoying) so you cannot install software vi the Internet.

Mount the ISO in the VM.

On the server run the following command:

sudo mount /dev/sr0 /cdrom

ensure that only the following line is uncommented in /etc/ap[t/sources.list

deb cdrom:[Ubuntu-Server 10.04 LTS _Lucid Lynx_ – Release amd64 (20100427)]/ lucid main restricted

Run sudo apt-get update to update the repository. Then install what you need.

A wrapper for grabbing performance info from Nagios plugin

check_procs is an example for a plugin which doesn’t deliver performance data:

./check_procs -a apache2 -w 1: -c 0:
PROCS OK: 33 processes with args ‘apache2’

This can be changed with the following wrapper script:

#!/bin/bash
LINE=`/usr/local/nagios/libexec/check_procs $*`
RC=$?
COUNT=`echo $LINE | awk '{print $3}'`
echo $LINE \| procs=$COUNT
exit $RC

Now you’ll get the number together with the required label:

PROCS OK: 33 processes with args ‘apache2’| procs=33

SeleniumHQ Server on Nagios/Linux Host

These commands are tailored for a nagios installation.

Starting the selenium rc:

java -jar /usr/local/nagios/libexec/selenium/selenium-server.jar -firefoxProfileTemplate /usr/local/nagios/libexec/selenium/ff_selenium/

Sample nagios check command:

 

./check_selenium com.example.tests.someWebsiteCom http://some.website.com*firefox

Schedule:

Currently, login test is every hour.

TF221161: There are conflicting definitions of the following work item fields in the warehouse

This is the error message in the Application Event Log on tfsserver:

 
Log Name:      Application
Source:        TFS Services
Date:          1/10/2011 2:04:39 PM
Event ID:      3300
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      TFSSERVER
Description:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 1/10/2011 7:04:39 PM
Machine: TFSSERVER
Application Domain: TfsJobAgent.exe
Assembly: Microsoft.TeamFoundation.Framework.Server, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Service Host:
Process Details:
  Process Name: TFSJobAgent
  Process Id: 1924
  Thread Id: 7972
  Account name: DOMAIN\TFS_Service

 

Detailed Message:
  Adapter: Microsoft.TeamFoundation.WorkItemTracking.WorkItemTrackingWarehouseAdapter
  Team Project Collection: sitename
TF221161: There are conflicting definitions of the following work item fields in the warehouse: Microsoft.VSTS.Common.BusinessValue<->Microsoft.VSTS.Common.BusinessValue (Direct). These conflicting definitions come from different project collections. Work items from project collection sitename will not be updated until the conflict is resolved. You can resolve the conflict by making the definitions of the field the same in all project collections, or marking the field as non-reportable in the project collection sitename. For more information, see the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkId=160807).
Event Xml:
<Event xmlns=”http://schemas.microsoft.com/win/2004/08/events/event“>
  <System>
    <Provider Name=”TFS Services” />
    <EventID Qualifiers=”0″>3300</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime=”2011-01-10T19:04:39.000000000Z” />
    <EventRecordID>23554</EventRecordID>
    <Channel>Application</Channel>
    <Computer>TFSSERVER.DOMAIN.local</Computer>
    <Security />
  </System>
  <EventData>
    <Data>TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 1/10/2011 7:04:39 PM
Machine: TFSSERVER
Application Domain: TfsJobAgent.exe
Assembly: Microsoft.TeamFoundation.Framework.Server, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Service Host:
Process Details:
  Process Name: TFSJobAgent
  Process Id: 1924
  Thread Id: 7972
  Account name: DOMAIN\svcTFS_Service
Detailed Message:
  Adapter: Microsoft.TeamFoundation.WorkItemTracking.WorkItemTrackingWarehouseAdapter
  Team Project Collection: ewholesale
TF221161: There are conflicting definitions of the following work item fields in the warehouse: Microsoft.VSTS.Common.BusinessValue&lt;-&gt;Microsoft.VSTS.Common.BusinessValue (Direct). These conflicting definitions come from different project collections. Work items from project collection ewholesale will not be updated until the conflict is resolved. You can resolve the conflict by making the definitions of the field the same in all project collections, or marking the field as non-reportable in the project collection ewholesale. For more information, see the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkId=160807).</Data>
  </EventData>
</Event>

​ Following this document on MSDN:

http://msdn.microsoft.com/library/ee921480(VS.100).aspx

Open the VS command prompt and run the following:

witadmin listfields /collection:http://xxxxxx:8080/tfs/sitename