<?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: Help on Data Aggregation from Logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-on-Data-Aggregation-from-Logs/m-p/278023#M83904</link>
    <description>&lt;P&gt;The first thing you are going to need to do is to extract the fields. If this is in XML/JSON format, you might be able to simply use |spath &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search |spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Otherwise you will have to use the field extractor, and try to tease out the data you need. &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/images/9/9d/CIM-extract_fields_UI.png"&gt;http://docs.splunk.com/images/9/9d/CIM-extract_fields_UI.png&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Or you can play around with inline extractions using |rex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "apiName":"(?&amp;lt;API_Name&amp;gt;./w+^") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then once you get it extracted you can do something like this. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    base search 
| rex field=_raw "apiName":"(?&amp;lt;API_Name&amp;gt;.\w+) "
| rex field=_raw "Start=(?&amp;lt;Start&amp;gt;\d+)"
| stats list(API_Name) by Start
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've not tested any of these regex's. It takes a bit of practice to get them right, but once you have the fields extracted, then you can do more with the data. &lt;/P&gt;

&lt;P&gt;Check out the documentation on extracting fields. &lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.4.2/Search/Extractfieldswithsearchcommands"&gt;https://docs.splunk.com/Documentation/Splunk/6.4.2/Search/Extractfieldswithsearchcommands&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jul 2016 17:04:34 GMT</pubDate>
    <dc:creator>JDukeSplunk</dc:creator>
    <dc:date>2016-07-25T17:04:34Z</dc:date>
    <item>
      <title>Help on Data Aggregation from Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-Data-Aggregation-from-Logs/m-p/278022#M83903</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;I am new to Splunk tool. But going through vast documentation also din't help me much.&lt;BR /&gt;
If someone can help me to know that how to achieve below out put from logs, would really be helpful.&lt;/P&gt;

&lt;P&gt;Below raw is just one sample from logs. So i need to have as many rows as we have objectCount.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Raw Output Logs&lt;/STRONG&gt;:&lt;BR /&gt;
&amp;lt;135&amp;gt;Jul 22 01:15:42 ******.nsroot.net {"datetime":"2016-07-22T05:14:40.292Z","apiName":"XYZ","apiVersion":1,"appName":"ABC","envName":"External-ADP","planName":"LMN","planVersion":1,"timeToServeRequest":922,"bytesSent":209,"requestProtocol":"https","requestMethod":"GET",requestTimestamp : 2016-07-22T01:14:39-04:00,responseTimestamp : 2016-07-22T01:14:40-04:00,X-Content-Type-Options : nosniff","responseBody":"","latency":"Initialization=0ms : Start=6ms : 576197e8e4b0d8a5ff967ffc=1ms : 576197e8e4b0d8a5ff967fff=3ms : 56f18e6ee4b06bb8f1889f36=0ms : 1326652068303=2ms : Activity Log 5=0ms : Request=1ms : HTTP GET Operation 5=38ms : HTTP POST Operation 8=519ms : HTTP PUT Operation 2=138ms : HTTP POST Operation 5=139ms : Response=75ms"}&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;REQUIRED OUTPUT&lt;/STRONG&gt; &lt;BR /&gt;
&lt;EM&gt;APIName&lt;/EM&gt; = XYZ&lt;BR /&gt;
&lt;EM&gt;timeToServeRequest&lt;/EM&gt; = 922&lt;BR /&gt;
&lt;EM&gt;Start&lt;/EM&gt; = 6ms&lt;/P&gt;

&lt;P&gt;Appreciate your help and response.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 07:59:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-Data-Aggregation-from-Logs/m-p/278022#M83903</guid>
      <dc:creator>viruvaibhav21</dc:creator>
      <dc:date>2016-07-22T07:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Data Aggregation from Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-Data-Aggregation-from-Logs/m-p/278023#M83904</link>
      <description>&lt;P&gt;The first thing you are going to need to do is to extract the fields. If this is in XML/JSON format, you might be able to simply use |spath &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search |spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Otherwise you will have to use the field extractor, and try to tease out the data you need. &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/images/9/9d/CIM-extract_fields_UI.png"&gt;http://docs.splunk.com/images/9/9d/CIM-extract_fields_UI.png&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Or you can play around with inline extractions using |rex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "apiName":"(?&amp;lt;API_Name&amp;gt;./w+^") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then once you get it extracted you can do something like this. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    base search 
| rex field=_raw "apiName":"(?&amp;lt;API_Name&amp;gt;.\w+) "
| rex field=_raw "Start=(?&amp;lt;Start&amp;gt;\d+)"
| stats list(API_Name) by Start
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've not tested any of these regex's. It takes a bit of practice to get them right, but once you have the fields extracted, then you can do more with the data. &lt;/P&gt;

&lt;P&gt;Check out the documentation on extracting fields. &lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.4.2/Search/Extractfieldswithsearchcommands"&gt;https://docs.splunk.com/Documentation/Splunk/6.4.2/Search/Extractfieldswithsearchcommands&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 17:04:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-Data-Aggregation-from-Logs/m-p/278023#M83904</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2016-07-25T17:04:34Z</dc:date>
    </item>
  </channel>
</rss>

