<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to generate a table where the values of my &amp;quot;serviceType&amp;quot; field appear as a column headers? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-table-where-the-values-of-my-quot-serviceType/m-p/290004#M87699</link>
    <description>&lt;P&gt;thanks for your fast reply.&lt;/P&gt;

&lt;P&gt;Apologies for not mentioning before, what will be the query if new field name of "serviceType" is to be displayed for every serviceType value. Something like below. &lt;/P&gt;

&lt;P&gt;servicetype1 servicetype2  servicetype3     servicetype4&lt;BR /&gt;
      xxx                  yyy                 zzz                      www&lt;/P&gt;</description>
    <pubDate>Tue, 15 Aug 2017 17:39:57 GMT</pubDate>
    <dc:creator>kaushik1218</dc:creator>
    <dc:date>2017-08-15T17:39:57Z</dc:date>
    <item>
      <title>How to generate a table where the values of my "serviceType" field appear as a column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-table-where-the-values-of-my-quot-serviceType/m-p/290002#M87697</link>
      <description>&lt;P&gt;Below is the example of single request with multiple lines where ServiceType is different.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3388iADAEF4EAECC0CE0B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Required result to be as below, where Service type is placed into single row with different field names&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3389i48CE52CE2D3CD692/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Happy to take any other suggestions. Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 14:58:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-table-where-the-values-of-my-quot-serviceType/m-p/290002#M87697</guid>
      <dc:creator>kaushik1218</dc:creator>
      <dc:date>2017-08-15T14:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a table where the values of my "serviceType" field appear as a column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-table-where-the-values-of-my-quot-serviceType/m-p/290003#M87698</link>
      <description>&lt;P&gt;Well in your sample output, the field name is same and will not work. If output like below is acceptable, try the query.&lt;/P&gt;

&lt;P&gt;OUTPUT&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time, RequestID SiteID Address senderURI serviceType StatusCode
xxx    yyy       xxx    ppp     qqqq      AnalogueTelevision,Broadband,..othervalues.. statuscodevalue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..your current search | stats values(serviceType) as serviceType by   _time, RequestID SiteID Address senderURI StatusCode | nomv serviceType
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;BR /&gt;
OUTPUT&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time, RequestID SiteID Address senderURI AnalogueTelevision Broadband DigitalTelevision Telephony StatusCode
xxx    yyy       xxx    ppp     qqqq      yes                yes       yes               yes   statuscodevalue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..your current search | eval temp=_time."#".RequestID."#".SiteID."##".Address."#".senderURI."#".StatusCode | stats count over temp by serviceType | rex field=temp "(?&amp;lt;time&amp;gt;\d+)#(?&amp;lt;RequestID&amp;gt;[^#]+)#(?&amp;lt;SiteID&amp;gt;[^#]+)#(?&amp;lt;Address&amp;gt;[^#]+)#(?&amp;lt;senderURI&amp;gt;[^#]+)#(?&amp;lt;StatusCode&amp;gt;[^#]+)" | fields - temp | rename time as _time| table _time, RequestID SiteID Address senderURI * StatusCode
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Aug 2017 17:02:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-table-where-the-values-of-my-quot-serviceType/m-p/290003#M87698</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-08-15T17:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a table where the values of my "serviceType" field appear as a column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-table-where-the-values-of-my-quot-serviceType/m-p/290004#M87699</link>
      <description>&lt;P&gt;thanks for your fast reply.&lt;/P&gt;

&lt;P&gt;Apologies for not mentioning before, what will be the query if new field name of "serviceType" is to be displayed for every serviceType value. Something like below. &lt;/P&gt;

&lt;P&gt;servicetype1 servicetype2  servicetype3     servicetype4&lt;BR /&gt;
      xxx                  yyy                 zzz                      www&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 17:39:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-a-table-where-the-values-of-my-quot-serviceType/m-p/290004#M87699</guid>
      <dc:creator>kaushik1218</dc:creator>
      <dc:date>2017-08-15T17:39:57Z</dc:date>
    </item>
  </channel>
</rss>

