<?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 Filtering mutiple table rows created from a single log entry in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-mutiple-table-rows-created-from-a-single-log-entry/m-p/361181#M65884</link>
    <description>&lt;P&gt;I have multiple JDBC connection pools and their realtime stats are written to a log on a regular basis.  I would like to isolate the information for a single pool (poolC) and create some visualizations from the data, allowing me to track pool performance over time. &lt;BR /&gt;
 My problem is that even after I've isolated the fields from the log entry, any attempts to filter based on the isolated fields fails.   I suspect this is because all the data originates from a single log entry.   Here is a sample output of a single log entry:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LATEST STATS 
   Pool Name :  PoolA[Num Active :   0]  [Max Idle Pool :   2]  [Min Idle Pool :   1]  [Total Connections Used :      533]
    Pool Name :  PoolB[Num Active :   0]  [Max Idle Pool :   2]  [Min Idle Pool :   1]  [Total Connections Used : 8]
    Pool Name :  PoolC[Num Active :   0]  [Max Idle Pool :   3]  [Min Idle Pool :   1]  [Total Connections Used : 890]
    Pool Name :  PoolD[Num Active :   0]  [Max Idle Pool :   3]  [Min Idle Pool :   1]  [Total Connections Used : 386] 
END STATS
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first thing I've done is to use the 'rex' command to pull out fields from the log entry.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="poolIndex" source="/dir/connectionPool.log" | rex max_match=0 field=_raw "Pool Name : (?&amp;lt;poolname&amp;gt;.+?(?=\[))\[Num Active :\s+(?&amp;lt;numactive&amp;gt;\d+)\]\s+\[Max Idle Pool :\s+(?&amp;lt;maxidlepool&amp;gt;\d+)\]\s+\[Min Idle Pool :\s+(?&amp;lt;minidlepool&amp;gt;\d+)\]\s+\[Total Connections Used :\s+(?&amp;lt;totconn&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With the fields defined, I then 'piped' the results to a table command to format the data to  tablular form:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table host _time poolname numactive maxactivepool maxidlepool minidlepool totconn
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This creates a table visualization of the data using the extracted fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;poolname          numactive          maxidlepool          minidlepool          totconn
PoolA                   0                2                 1                    533
PoolB                   0                2                 1                    8
PoolC                   0                3                 1                    890
PoolD                   0                3                 1                    386
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My hope was that I could then use the 'search' command to filter the results for just the poolC row of data.  So I added an additional 'pipe'  to search command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search poolname="poolC"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the full query is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="poolIndex" source="/dir/connectionPool.log" | rex max_match=0 field=_raw "Pool Name : (?&amp;lt;poolname&amp;gt;.+?(?=\[))\[Num Active :\s+(?&amp;lt;numactive&amp;gt;\d+)\]\s+\[Max Active Pool :\s+(?&amp;lt;maxactivepool&amp;gt;\d+)\]\s+\[Max Idle Pool :\s+(?&amp;lt;maxidlepool&amp;gt;\d+)\]\s+\[Min Idle Pool :\s+(?&amp;lt;minidlepool&amp;gt;\d+)\]\s+\[Total Connections Used :\s+(?&amp;lt;totconn&amp;gt;\d+)"  | table host _time poolname numactive maxactivepool maxidlepool minidlepool totconn | search poolname="poolC"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Even though I am attempting to filter on poolname="poolC", the records for all pools are returned.   I suspect this is because the filter is still acting on the single log entry from which all the data was derived.   I would like the filter to act on the 'table' results and return the single row containing the poolC metrics.&lt;/P&gt;

&lt;P&gt;Is there a command that will filter the results of a table when the rows are derived from a single log entry?&lt;BR /&gt;
Is the 'table' command the best way to approach this problem?&lt;/P&gt;

&lt;P&gt;Ultimately my goal is to isolate the poolC metrics so that I can create charts and visualizations on it over time.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jun 2017 13:06:40 GMT</pubDate>
    <dc:creator>dhennessey</dc:creator>
    <dc:date>2017-06-22T13:06:40Z</dc:date>
    <item>
      <title>Filtering mutiple table rows created from a single log entry</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-mutiple-table-rows-created-from-a-single-log-entry/m-p/361181#M65884</link>
      <description>&lt;P&gt;I have multiple JDBC connection pools and their realtime stats are written to a log on a regular basis.  I would like to isolate the information for a single pool (poolC) and create some visualizations from the data, allowing me to track pool performance over time. &lt;BR /&gt;
 My problem is that even after I've isolated the fields from the log entry, any attempts to filter based on the isolated fields fails.   I suspect this is because all the data originates from a single log entry.   Here is a sample output of a single log entry:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LATEST STATS 
   Pool Name :  PoolA[Num Active :   0]  [Max Idle Pool :   2]  [Min Idle Pool :   1]  [Total Connections Used :      533]
    Pool Name :  PoolB[Num Active :   0]  [Max Idle Pool :   2]  [Min Idle Pool :   1]  [Total Connections Used : 8]
    Pool Name :  PoolC[Num Active :   0]  [Max Idle Pool :   3]  [Min Idle Pool :   1]  [Total Connections Used : 890]
    Pool Name :  PoolD[Num Active :   0]  [Max Idle Pool :   3]  [Min Idle Pool :   1]  [Total Connections Used : 386] 
END STATS
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first thing I've done is to use the 'rex' command to pull out fields from the log entry.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="poolIndex" source="/dir/connectionPool.log" | rex max_match=0 field=_raw "Pool Name : (?&amp;lt;poolname&amp;gt;.+?(?=\[))\[Num Active :\s+(?&amp;lt;numactive&amp;gt;\d+)\]\s+\[Max Idle Pool :\s+(?&amp;lt;maxidlepool&amp;gt;\d+)\]\s+\[Min Idle Pool :\s+(?&amp;lt;minidlepool&amp;gt;\d+)\]\s+\[Total Connections Used :\s+(?&amp;lt;totconn&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With the fields defined, I then 'piped' the results to a table command to format the data to  tablular form:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table host _time poolname numactive maxactivepool maxidlepool minidlepool totconn
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This creates a table visualization of the data using the extracted fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;poolname          numactive          maxidlepool          minidlepool          totconn
PoolA                   0                2                 1                    533
PoolB                   0                2                 1                    8
PoolC                   0                3                 1                    890
PoolD                   0                3                 1                    386
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My hope was that I could then use the 'search' command to filter the results for just the poolC row of data.  So I added an additional 'pipe'  to search command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search poolname="poolC"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the full query is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="poolIndex" source="/dir/connectionPool.log" | rex max_match=0 field=_raw "Pool Name : (?&amp;lt;poolname&amp;gt;.+?(?=\[))\[Num Active :\s+(?&amp;lt;numactive&amp;gt;\d+)\]\s+\[Max Active Pool :\s+(?&amp;lt;maxactivepool&amp;gt;\d+)\]\s+\[Max Idle Pool :\s+(?&amp;lt;maxidlepool&amp;gt;\d+)\]\s+\[Min Idle Pool :\s+(?&amp;lt;minidlepool&amp;gt;\d+)\]\s+\[Total Connections Used :\s+(?&amp;lt;totconn&amp;gt;\d+)"  | table host _time poolname numactive maxactivepool maxidlepool minidlepool totconn | search poolname="poolC"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Even though I am attempting to filter on poolname="poolC", the records for all pools are returned.   I suspect this is because the filter is still acting on the single log entry from which all the data was derived.   I would like the filter to act on the 'table' results and return the single row containing the poolC metrics.&lt;/P&gt;

&lt;P&gt;Is there a command that will filter the results of a table when the rows are derived from a single log entry?&lt;BR /&gt;
Is the 'table' command the best way to approach this problem?&lt;/P&gt;

&lt;P&gt;Ultimately my goal is to isolate the poolC metrics so that I can create charts and visualizations on it over time.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 13:06:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-mutiple-table-rows-created-from-a-single-log-entry/m-p/361181#M65884</guid>
      <dc:creator>dhennessey</dc:creator>
      <dc:date>2017-06-22T13:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering mutiple table rows created from a single log entry</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filtering-mutiple-table-rows-created-from-a-single-log-entry/m-p/361182#M65885</link>
      <description>&lt;P&gt;If the &lt;CODE&gt;rex&lt;/CODE&gt; command finds more than one match, it puts them all into a multi-value field.  To treat that field as multiple events, you must use the &lt;CODE&gt;mvexpand&lt;/CODE&gt; command.  Since you have several mv fields, getting them all expanded is a little tricky, but there's an example in the search ref manual.  See Example 3 at &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.6.1/SearchReference/Mvexpand"&gt;http://docs.splunk.com/Documentation/Splunk/6.6.1/SearchReference/Mvexpand&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 14:22:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filtering-mutiple-table-rows-created-from-a-single-log-entry/m-p/361182#M65885</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-06-22T14:22:14Z</dc:date>
    </item>
  </channel>
</rss>

