Sunday, June 2, 2013

How to remove 'Pages-' from SharePoint page title

This is a pain if you have activated publishing, Page title will appear as Pages-'Name'

Master page code looks like this:
image
This place holder will be replaced with title from the page layout.

Here goes the code from page layout:image
Long story short, The two important lines here are 36 & 37. Line 36 adds the list’s name (in our case, Pages), line 37 (<SharePointWebControls:FieldValue FieldName=”Title” runat=”server”/>) adds the title value of the page (so the actual title).
I removed line 36 (and removed the dash from line 37), the 'pages' titles are now displayed as I wanted them to:
image

Hope this helps!

Saturday, February 2, 2013

How to use Log parser with IIS logs


Download and install log parser 2.2 from below link:
Make sure you read all the software usage policies and agreements before you use any software.
Once you install the software, you will find the exe and related files at- C:\Program Files\Log Parser 2.2
Copy the files and put it in a folder of your convenience.
Copy the log file folder from C:\inetpub\logs\LogFiles\
The folder name would be something like W3SVC1612407519 in which ‘1612407519’ will be ID of the web application from IIS which you can find out as shown below:


The log files in the folder will be text files. Screenshot below:


So now that we have the folder, copy the bat files to the same folder in which we have all the files and log file folder.
Click on edit you will see a query like:
LogParser.exe -i:IISW3C "SELECT TOP 1000 cs-uri-stem as URIStem, COUNT(*) as Hits INTO C:\Users\libin.makkalikkal\Desktop\TestLogparser\URLHitDetails.csv FROM C:\Users\libin.makkalikkal\Desktop\TestLogparser\W3SVC1612407519\* WHERE URIStem Is Not Null AND date>'2013-01-15' GROUP BY URIStem" -e 1
The file path in green is the path of csv file into which we are writing the output. The file path in red is the path where IIS logs are located. Please change the date highlighted in blue to the date starting from which we require data. Edit the bat file with new file locations and date, save and run it.

You will see the ouput csv file created in the folder with the query results.

You can use the query to get information from a specific time period if used as below:

SELECT QUANTIZE(TO_LOCALTIME(TO_TIMESTAMP(date, time)), 3600) AS Hour,
    COUNT(*) AS Hits FROM c:\inetpub\logs\LogFiles\W3SVC1\*
WHERE date>'2010-03-01' and date<'2010-04-01' Group By Hour

Some useful links to create and edit the log parser queries: