<?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 Custom Query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Custom-Query/m-p/49845#M179541</link>
    <description>&lt;P&gt;I look for all strings as shown below. I need to calculate the number of such calls (8 in this case) and the average of (3, 5, 8, 4, 6, 12, 4, 15). It would show in graph as number of calls and average time. Can some help on this please?&lt;/P&gt;

&lt;P&gt;stat: Encoder return in 3 ms&lt;BR /&gt;
stat: Encoder return in 5 ms&lt;BR /&gt;
stat: Encoder return in 8 ms&lt;BR /&gt;
stat: Encoder return in 4 ms&lt;BR /&gt;
stat: Encoder return in 6 ms&lt;BR /&gt;
stat: Encoder return in 12 ms&lt;BR /&gt;
stat: Encoder return in 4 ms&lt;BR /&gt;
stat: Encoder return in 15 ms&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2013 18:54:12 GMT</pubDate>
    <dc:creator>vpalleti</dc:creator>
    <dc:date>2013-05-29T18:54:12Z</dc:date>
    <item>
      <title>Custom Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Query/m-p/49845#M179541</link>
      <description>&lt;P&gt;I look for all strings as shown below. I need to calculate the number of such calls (8 in this case) and the average of (3, 5, 8, 4, 6, 12, 4, 15). It would show in graph as number of calls and average time. Can some help on this please?&lt;/P&gt;

&lt;P&gt;stat: Encoder return in 3 ms&lt;BR /&gt;
stat: Encoder return in 5 ms&lt;BR /&gt;
stat: Encoder return in 8 ms&lt;BR /&gt;
stat: Encoder return in 4 ms&lt;BR /&gt;
stat: Encoder return in 6 ms&lt;BR /&gt;
stat: Encoder return in 12 ms&lt;BR /&gt;
stat: Encoder return in 4 ms&lt;BR /&gt;
stat: Encoder return in 15 ms&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2013 18:54:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Query/m-p/49845#M179541</guid>
      <dc:creator>vpalleti</dc:creator>
      <dc:date>2013-05-29T18:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Query/m-p/49846#M179542</link>
      <description>&lt;P&gt;This might do it -&lt;/P&gt;

&lt;P&gt;Data as a table&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| rex "Encoder return in (?&amp;lt;ms&amp;gt;\d+) ms"
| bucket span=1h _time
| stats count avg(ms) as AvgMs by _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Graph of count&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| rex "Encoder return in (?&amp;lt;ms&amp;gt;\d+) ms"
| timechart span=1h count 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Graph of average ms&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| rex "Encoder return in (?&amp;lt;ms&amp;gt;\d+) ms"
| timechart span=1h avg(ms) as AvgMs
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2013 19:27:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Query/m-p/49846#M179542</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-05-29T19:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Query/m-p/49847#M179543</link>
      <description>&lt;P&gt;You need to extract the data and then enumerate the count of events and calculate the average for the extracted value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  sourcetype="answers-1369855768" 
| rex field=_raw "return\sin\s(?&amp;lt;return_in_ms&amp;gt;\d+)\s+\w+"
| stats count(return_in_ms) AS count avg(return_in_ms) AS avg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That will render something like this:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://splunk-base.splunk.com//storage/Untitled108.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2013 19:30:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Query/m-p/49847#M179543</guid>
      <dc:creator>Gilberto_Castil</dc:creator>
      <dc:date>2013-05-29T19:30:53Z</dc:date>
    </item>
  </channel>
</rss>

