<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Search Nuggets &#187; Madalina Rogoz</title>
	<atom:link href="http://blog.comperiosearch.com/blog/author/mrogoz/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.comperiosearch.com</link>
	<description>A blog about Search as THE solution</description>
	<lastBuildDate>Mon, 13 Jun 2016 08:59:45 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.40</generator>
	<item>
		<title>SharePoint ULS log analysis using ELK</title>
		<link>http://blog.comperiosearch.com/blog/2014/08/01/sharepoint-log-analysis-using-elk/</link>
		<comments>http://blog.comperiosearch.com/blog/2014/08/01/sharepoint-log-analysis-using-elk/#comments</comments>
		<pubDate>Fri, 01 Aug 2014 11:31:06 +0000</pubDate>
		<dc:creator><![CDATA[Madalina Rogoz]]></dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Elasticsearch]]></category>
		<category><![CDATA[Kibana]]></category>
		<category><![CDATA[log analysis]]></category>
		<category><![CDATA[logstash]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">http://blog.comperiosearch.com/?p=2775</guid>
		<description><![CDATA[E is for Elasticsearch Elasticsearch is an open source search and analytics engine that extends the limits of full-text search through a robust set of APIs and DSLs, to deliver a flexible and almost limitless search experience. L is for Logstash One of the most popular open source log parser solutions on the market, Logstash has the possibility of reading any data source [...]]]></description>
				<content:encoded><![CDATA[<h3>E is for Elasticsearch</h3>
<p><a href="http://www.elasticsearch.org/">Elasticsearch</a> is an open source search and analytics engine that extends the limits of full-text search through a robust set of APIs and DSLs, to deliver a flexible and almost limitless search experience.</p>
<h3>L is for Logstash</h3>
<p>One of the most popular open source log parser solutions on the market, <a href="http://logstash.net/">Logstash</a> has the possibility of reading any data source and extracting the data in JSON format, easy to use and running in minutes.</p>
<h3>K is for Kibana</h3>
<p>A data visualization engine, <a href="http://www.elasticsearch.org/overview/kibana/">Kibana</a> allows the user to create custom dashboards and to analyze Elasticsearch data on-the-fly and in real-time.</p>
<h3>Getting set up</h3>
<p>To start using this technology, you just need to <a href="http://www.elasticsearch.org/overview/elkdownloads/">install</a> the three above mentioned components, which actually means downloading and unzipping three archive files.</p>
<p>The data flow is this: the log files are text files residing in a folder. Logstash will use a configuration file to read from the logs and parse all the entries. The parsed data will be sent to Elasticsearch for storing. Once here, it can be easily read and displayed by Kibana.</p>
<p><img class="alignnone size-full wp-image-2779" src="http://blog.comperiosearch.com/wp-content/uploads/2014/08/elk004.jpg" alt="elk004" width="608" height="107" /></p>
<h3>Parsing SharePoint ULS log files with Logstash</h3>
<p>We will now focus on the most simple and straightforward way of getting this to work, without any additional configuration or settings. Our goal is to open Kibana and be able to configure some charts that will help us visualize and explore what type of entries we have in the SharePoint ULS logs, and to be able to search the logs for interesting entries.</p>
<p>To begin, we need some ULS log files from SharePoint that will be placed in a folder on the server (I am working on a Windows Server virtual environment) where we are testing the ELK stack. My ULS logs are located here: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS</p>
<p>As an example, the first line in one of my log files looks like this:</p><pre class="crayon-plain-tag">05/06/2014 10:20:20.85 wsstracing.exe (0x0900)                 0x0928SharePoint Foundation         Tracing Controller Service    5152InformationTracing Service started.</pre><p><span class="TextRun SCX192432813" style="color: #000000" xml:lang="EN-US"><span class="NormalTextRun SCX192432813">The next step is to build the configuration file. This is a text file with a .</span><span class="SpellingError SCX192432813">config</span><span class="NormalTextRun SCX192432813"> extension, located by defau</span></span><span class="TextRun SCX192432813" style="color: #000000" xml:lang="EN-US"><span class="NormalTextRun SCX192432813">l</span></span><span class="TextRun SCX192432813" style="color: #000000" xml:lang="EN-US"><span class="NormalTextRun SCX192432813">t in the </span><span class="SpellingError SCX192432813">Logstash</span><span class="NormalTextRun SCX192432813"> folder. The starting point for the content of this file </span></span><span class="TextRun SCX192432813" style="color: #000000" xml:lang="EN-US"><span class="NormalTextRun SCX192432813">would be</span></span><span class="TextRun SCX192432813" style="color: #000000" xml:lang="EN-US"><span class="NormalTextRun SCX192432813">:</span></span><span class="EOP SCX192432813" style="color: #000000"> </span></p><pre class="crayon-plain-tag">input {  
 file {  
  type =&gt; "sharepointlog" 
    path =&gt; ["[folder where the logs reside]/*.log"] 
   start_position =&gt; "beginning" 
   codec =&gt; "plain" 
} 
} 
filter  
{ 
 } 
output  
{    
 elasticsearch {  
embedded =&gt; true 
 } 
}</pre><p>The Input defines the location of the logs and some reading parameters, like the starting position where Logstash will begin parsing the files. The Output section defines the location of the parsed data, in our case the Elasticsearch instance installed on the same server.</p>
<p>Now for the important part, the Filter section. The Filter section contains one or more GROK patterns that are used by Logstash for identifying the format of the log entries. There are many types of entries, but we are focusing on the event type and message, so we have to parse all the parameters up to the message part in order to get what we need.</p>
<p>The documentation is pretty detailed when it comes to GROK and a <a href="http://grokdebug.herokuapp.com/">pattern debugger website</a> with a GROK testing engine is available online, so you can develop and test your patterns before actually running them in Logstash.</p>
<p>So this is what I came up with for the SharePoint ULS logs:</p><pre class="crayon-plain-tag">filter { 
   if [type] == "sharepointlog" { 
grok { 
match =&gt; [ "message",  
"(?&lt;parsedtime&gt;%{MONTHNUM}/%{MONTHDAY}/%{YEAR} %{HOUR}:%{MINUTE}:%{SECOND}) \t%{DATA:process} \(%{DATA:processcode}\)(\s*)\t%{DATA:tid}(\s*)\t(?&lt;area&gt;.*)(\s*)\t(?&lt;category&gt;.*)(\s*)\t%{WORD:eventID}(\s*)\t%{WORD:level}(\s*)\t%{DATA:eventmessage}\t%{UUID:CorrelationID}"] 
match =&gt; [ "message",  
"(?&lt;parsedtime&gt;%{MONTHNUM}/%{MONTHDAY}/%{YEAR} %{HOUR}:%{MINUTE}:%{SECOND}) \t%{DATA:process} \(%{DATA:processcode}\)(\s*)\t%{DATA:tid}(\s*)\t(?&lt;area&gt;.*)(\s*)\t(?&lt;category&gt;.*)(\s*)\t%{WORD:eventID}(\s*)\t%{WORD:level}(\s*)\t%{DATA:eventmessage}"] 
match =&gt; [ "message",  
“(?&lt;parsedtime&gt;%{MONTHNUM}/%{MONTHDAY}/%{YEAR} %{HOUR}:%{MINUTE}:%{SECOND})%{GREEDYDATA}\t%{DATA:process} \(%{DATA:processcode}\)(\s*)\t%{DATA:tid}(\s*)\t(?&lt;area&gt;.*)(\s*)\t(?&lt;category&gt;.*)(\s*)\t%{WORD:eventID}(\s*)\t%{WORD:level}(\s*)\t%{DATA:eventmessage}"] 
} 
date { 
match =&gt; ["parsedtime","MM/dd/YYYY HH:mm:ss.SSS"] 
} 
   } 
}</pre><p></p>
<h3>Logstash in action</h3>
<p>All that&#8217;s left to do is to get Logstash going and see what comes out. Run the following on the command line:</p><pre class="crayon-plain-tag">logstash.bat agent -f "sharepoint.conf"</pre><p>This runs logstash as an agent, so it will monitor the file or the folder you specify in the input section of the config for changes. If you are indexing a folder where files appear periodically, you don&#8217;t need to worry about restarting the process, it will continue on its own.</p>
<h3>Kibana time</h3>
<p>Now let&#8217;s create a new dashboard in Kibana and see what was indexed. The most straight-forward panel type is Histogram. Make no changes to the default settings of this panel (Chart value = count, Time field = @timestamp) and you should see something similar to this:</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2014/08/elk005.jpg"><img class="alignnone wp-image-2780 size-medium" src="http://blog.comperiosearch.com/wp-content/uploads/2014/08/elk005-300x125.jpg" alt="elk005" width="300" height="125" /></a></p>
<p><span class="TextRun SCX61371348" style="color: #000000" xml:lang="EN-US"><span class="NormalTextRun SCX61371348">To get some more relevant information, we can add some pie charts and let them display other properties that we have mapped, for example ‘process’ or ‘</span></span><span class="TextRun SCX61371348" style="color: #000000" xml:lang="EN-US"><span class="NormalTextRun SCX61371348">area</span></span><span class="TextRun SCX61371348" style="color: #000000" xml:lang="EN-US"><span class="NormalTextRun SCX61371348">’. </span></span><span class="LineBreakBlob BlobObject SCX61371348" style="color: #000000"><span class="SCX61371348"> </span><br class="SCX61371348" /></span></p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2014/08/elk001.jpg"><img class="alignnone size-medium wp-image-2776" src="http://blog.comperiosearch.com/wp-content/uploads/2014/08/elk001-300x68.jpg" alt="elk001" width="300" height="68" /></a></p>
<p><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="SpellingError SCX4542470">Now</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">let&#8217;s</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">turn</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">this</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">up</span><span class="NormalTextRun SCX4542470"> a </span><span class="SpellingError SCX4542470">notch</span><span class="NormalTextRun SCX4542470">:</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">t</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="SpellingError SCX4542470">hrough</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">Kibana</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">we</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">can</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">take</span><span class="NormalTextRun SCX4542470"> a look at the </span><span class="SpellingError SCX4542470">err</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="SpellingError SCX4542470">ors</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="NormalTextRun SCX4542470"> in the SharePoint logs. </span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="SpellingError SCX4542470">Create</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="NormalTextRun SCX4542470"> a </span><span class="SpellingError SCX4542470">pie</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">chart</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">that</span><span class="NormalTextRun SCX4542470"> displays the &#8220;</span><span class="SpellingError SCX4542470">level</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="NormalTextRun SCX4542470">&#8221; </span><span class="SpellingError SCX4542470">field</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="NormalTextRun SCX4542470">. By</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">clicking</span><span class="NormalTextRun SCX4542470"> on the &#8220;</span><span class="SpellingError SCX4542470">Unexpected</span><span class="NormalTextRun SCX4542470">&#8221; slice in </span><span class="SpellingError SCX4542470">this</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">chart</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">you</span><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">will</span><span class="NormalTextRun SCX4542470"> filter all the </span><span class="SpellingError SCX4542470">dashboard</span><span class="NormalTextRun SCX4542470"> on </span><span class="SpellingError SCX4542470">this</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="NormalTextRun SCX4542470"> </span><span class="SpellingError SCX4542470">value</span></span><span class="TextRun SCX4542470" style="color: #000000" xml:lang="SV-SE"><span class="NormalTextRun SCX4542470">. </span></span><span class="EOP SCX4542470" style="color: #000000"> </span></p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2014/08/elk002.jpg"><img class="alignnone size-medium wp-image-2777" src="http://blog.comperiosearch.com/wp-content/uploads/2014/08/elk002-300x151.jpg" alt="elk002" width="300" height="151" /></a></p>
<p>Kibana will automatically refresh the page, the filter itself will be displayed in the &#8220;Filter&#8221; row and all you will see are the &#8220;Unexpected&#8221; events.  Time to turn to the help of a Table chart: by displaying the columns you select on the Fields section of this chart, you can view and sort the log entries for a more detailed analysis of the unexpected events.</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2014/08/elk003.jpg"><img class="alignnone size-medium wp-image-2778" src="http://blog.comperiosearch.com/wp-content/uploads/2014/08/elk003-300x74.jpg" alt="elk003" width="300" height="74" /></a></p>
<p><span class="TextRun SCX126625747" style="color: #000000" xml:lang="SV-SE"><span class="NormalTextRun SCX126625747">As the </span></span><span class="TextRun SCX126625747" style="color: #000000" xml:lang="SV-SE"><span class="SpellingError SCX126625747">Logstash</span><span class="NormalTextRun SCX126625747"> process </span><span class="SpellingError SCX126625747">runs</span><span class="NormalTextRun SCX126625747"> as an agent, </span><span class="SpellingError SCX126625747">you</span><span class="NormalTextRun SCX126625747"> </span><span class="SpellingError SCX126625747">can</span><span class="NormalTextRun SCX126625747"> monitor the SharePoint events in </span><span class="SpellingError SCX126625747">real-</span></span><span class="TextRun SCX126625747" style="color: #000000" xml:lang="SV-SE"><span class="SpellingError SCX126625747">time</span><span class="NormalTextRun SCX126625747">!</span></span><span class="EOP SCX126625747" style="color: #000000"> So there you have it, SharePoint log analysis using ELK.</span></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2014/08/01/sharepoint-log-analysis-using-elk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SharePoint search display templates made easy</title>
		<link>http://blog.comperiosearch.com/blog/2014/06/23/sharepoint-search-display-templates/</link>
		<comments>http://blog.comperiosearch.com/blog/2014/06/23/sharepoint-search-display-templates/#comments</comments>
		<pubDate>Mon, 23 Jun 2014 10:49:47 +0000</pubDate>
		<dc:creator><![CDATA[Madalina Rogoz]]></dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[display templates]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://blog.comperiosearch.com/?p=2625</guid>
		<description><![CDATA[One of the most interesting features in SharePoint 2013 are the display templates. This blog post will describe how to customize a search display template in order to show the item created date. The display templates are located in the site collection root site, under the _catalogs/Display Templates folder. Each template has two files: the html [...]]]></description>
				<content:encoded><![CDATA[<p>One of the most interesting features in SharePoint 2013 are the display templates. This blog post will describe how to customize a search display template in order to show the item created date.</p>
<p>The display templates are located in the site collection root site, under the _catalogs/Display Templates folder. Each template has two files: the html file and a javascript file. The javascript file is the one that SharePoint uses, while the html exists in order to make it easier for us developers to create and customize the display templates. Once an html file has been modified, SharePoint generates the corresponding updated javascript file, so the process is fully automated.</p>
<p>So what are the steps involved in creating a new display template?</p>
<p>In SharePoint designer, after opening the root website, navigate to the Display Templates folder. Here, in the Search subfolder, you will find the display templates that SharePoint uses for many types of results – documents, web sites, people and others. Choose a display template as a starting point for your own, depending on the result type that you are targeting, copy it and then rename it. Once saved, you will see that SharePoint has already generated the corresponding javascript file. Modify the html file as you wish. What is left to do now is to link the template to an actual result type, so that SharePoint knows what to associate your display template to. This can be done through the interface, by navigating to Site Settings – Search Result Types.</p>
<p>Let’s take it step by step.</p>
<h3>Duplicating an existing display template</h3>
<p>Open the site collection with SharePoint designer. Navigate to the Display Templates folder under <em>_catalogs\masterpage\display templates</em>. Here you will find some Folders that SharePoint uses to group Display Templates together.</p>
<p>The Word item template is in the Search folder. Make a copy of the <em>Item_Word.html</em> and rename it to <em>ComperioItem_Word.html</em></p>
<p><img class="alignnone wp-image-2626 size-full" src="http://blog.comperiosearch.com/wp-content/uploads/2014/06/spdisptemp_01.png" alt="spdisptemp_01" width="509" height="221" /></p>
<p>Edit the file and inside you will see some html and javascript code.</p>
<p>Edit the <strong>title field</strong> so that your custom template has a different display name than the original one.</p>
<p>The <em>&lt;mso:CustomDocumentProperties&gt;</em> tag contains some properties of the template. Some important properties are:</p>
<ul>
<li><em>TargetControlType</em> – tells SharePoint what the template is used for (search results, web parts, filters)</li>
<li><em>ManagedPropertyMapping</em> &#8211; contains a list of the managed properties that are or can be used by the current template</li>
</ul>
<p>The <em>&lt;body&gt;</em> tag contains the rendering logic for the display template.</p>
<p>The template can only recognize the managed properties that are listed in the header. To use another managed property, add it here. We are using the <em>Created</em> property that displays the document created date.</p><pre class="crayon-plain-tag">&lt;mso:ManagedPropertyMapping msdt:dt="string"&gt; 
'Title':'Title','Path':'Path', [………..] , ‘Created’:’Created’ 
&lt;/mso:ManagedPropertyMapping&gt;</pre><p>Now that the template is aware of the property, you can use it by adding it to the body. Add the line below in the Body of the rendering template:</p><pre class="crayon-plain-tag">&lt;div class="ms-descriptiontext"&gt; _#= ctx.CurrentItem.Created =#_ &lt;/div&gt;</pre><p><img class="alignnone wp-image-2627 size-full" src="http://blog.comperiosearch.com/wp-content/uploads/2014/06/spdisptemp_02.png" alt="spdisptemp_02" width="649" height="99" /></p>
<h3>Mapping the display template to a result type</h3>
<p>Now we are going to manually link the display template to a result type, so that we can see that it works.</p>
<p>In order for SharePoint to use your custom template, it needs to know of it. So navigate to Site Actions – Site Settings and under Site Collection Administration choose Search Result Types. Create a New Result Type for your template like below:</p>
<ul>
<li>Choose a Name</li>
<li>Choose Microsoft Word as content to match</li>
<li>Choose your custom display template</li>
</ul>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2014/06/spdisptemp_03.png"><img class="alignnone wp-image-2628 size-medium" src="http://blog.comperiosearch.com/wp-content/uploads/2014/06/spdisptemp_03-300x189.png" alt="spdisptemp_03" width="300" height="189" /></a></p>
<p>Now go to the results page and search for a word document. The results should display a date looking like this:</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2014/06/spdisptemp_04.png"><img class="alignnone size-medium wp-image-2629" src="http://blog.comperiosearch.com/wp-content/uploads/2014/06/spdisptemp_04-300x94.png" alt="spdisptemp_04" width="300" height="94" /></a></p>
<p>We have only been scratching the surface and a lot more customization can be done here, for example formatting the date value in javascript by using a function like <em>format(&#8220;yyyy-MM-dd&#8221;) </em>on a Date object. Combined, SharePoint and javascript have (almost) endless possibilities.</p>
<p>Happy coding!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2014/06/23/sharepoint-search-display-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
