<?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: Build table by char position in string in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Build-table-by-char-position-in-string/m-p/467174#M80516</link>
    <description>&lt;P&gt;@ea7777777 try the following run anywhere example based on the sample data provided. Commands till &lt;CODE&gt;| fields _raw&lt;/CODE&gt; generate data, you can pipe the command from &lt;CODE&gt;| eval ...&lt;/CODE&gt; and validate the output with your query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="2020/02/14/16:12:28:872 MachineNumber=\"K003991_HT\" Pass=\"FPPF\""
| KV
| fields - _raw
| eval Pass=replace(replace(Pass,"(\w{1})","\1,"),",$","")
| makemv Pass delim=","
| mvexpand Pass
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 15 Feb 2020 19:44:59 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2020-02-15T19:44:59Z</dc:date>
    <item>
      <title>Build table by char position in string</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Build-table-by-char-position-in-string/m-p/467173#M80515</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I´ve got this event -&amp;gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;2020/02/14/16:12:28:872&lt;BR /&gt;
MachineNumber="K003991_HT"&lt;BR /&gt;
Pass="FPPPPPPFPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Each position of the pass value gives an pass or fail for one position (1..80 but can also be only 1..45). &lt;/P&gt;

&lt;P&gt;For example Pass="FPPF" says -&amp;gt;&lt;/P&gt;

&lt;P&gt;Position_1 = Fail&lt;BR /&gt;
Position_2 = Pass&lt;BR /&gt;
Position_3 = Pass&lt;BR /&gt;
Position_4 = Fail&lt;/P&gt;

&lt;P&gt;Now I want to buld an table to show which position has how much fails of all events. How to do this?&lt;/P&gt;

&lt;P&gt;One possibility could be to use mvexpand and build more events. &lt;/P&gt;

&lt;P&gt;For example, build from this  -&amp;gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;2020/02/14/16:12:28:872  MachineNumber="K003991_HT"  Pass="FPPF"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;that events -&amp;gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;2020/02/14/16:12:28:872  MachineNumber="K003991_HT"  Pass="Fail" Position="1"&lt;BR /&gt;
 2020/02/14/16:12:28:872  MachineNumber="K003991_HT"  Pass="Pass" Position="2"&lt;BR /&gt;
 2020/02/14/16:12:28:872  MachineNumber="K003991_HT"  Pass="Pass" Position="3"&lt;BR /&gt;
 2020/02/14/16:12:28:872  MachineNumber="K003991_HT"  Pass="Fail" Position="4"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;...but how is it possible do do this? Or is there an other possibility to buld my table? Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:06:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Build-table-by-char-position-in-string/m-p/467173#M80515</guid>
      <dc:creator>ea7777777</dc:creator>
      <dc:date>2020-09-30T04:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Build table by char position in string</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Build-table-by-char-position-in-string/m-p/467174#M80516</link>
      <description>&lt;P&gt;@ea7777777 try the following run anywhere example based on the sample data provided. Commands till &lt;CODE&gt;| fields _raw&lt;/CODE&gt; generate data, you can pipe the command from &lt;CODE&gt;| eval ...&lt;/CODE&gt; and validate the output with your query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="2020/02/14/16:12:28:872 MachineNumber=\"K003991_HT\" Pass=\"FPPF\""
| KV
| fields - _raw
| eval Pass=replace(replace(Pass,"(\w{1})","\1,"),",$","")
| makemv Pass delim=","
| mvexpand Pass
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Feb 2020 19:44:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Build-table-by-char-position-in-string/m-p/467174#M80516</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-02-15T19:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Build table by char position in string</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Build-table-by-char-position-in-string/m-p/467175#M80517</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="2020/02/14/16:12:28:872
MachineNumber=\"K003991_HT\"
Pass=\"FPPPPPPFPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\""
| rex "(?&amp;lt;time&amp;gt;^\S+)"
| eval _time=strptime(time,"%Y/%m/%d/%T.%3Q")
| kv
| table _time MachineNumber Pass
| eval Pass=split(Pass,"")
| mvexpand Pass
| streamstats count as Position
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, folks&lt;BR /&gt;
The detail:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt; &lt;CODE&gt;kv&lt;/CODE&gt; extracts &lt;EM&gt;key=value&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt; &lt;CODE&gt;split()&lt;/CODE&gt; makes multivalue.&lt;/LI&gt;
&lt;LI&gt; &lt;CODE&gt;mvexpand&lt;/CODE&gt; creates events from multivalue.&lt;/LI&gt;
&lt;LI&gt; &lt;CODE&gt;streamstats&lt;/CODE&gt; makes count named &lt;EM&gt;Position&lt;/EM&gt;.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Sat, 15 Feb 2020 22:49:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Build-table-by-char-position-in-string/m-p/467175#M80517</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-15T22:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Build table by char position in string</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Build-table-by-char-position-in-string/m-p/467176#M80518</link>
      <description>&lt;P&gt;Works fine! Thanks!&lt;/P&gt;

&lt;P&gt;Only change from my side was -&amp;gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | streamstats count as Position by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Feb 2020 16:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Build-table-by-char-position-in-string/m-p/467176#M80518</guid>
      <dc:creator>ea7777777</dc:creator>
      <dc:date>2020-02-17T16:55:52Z</dc:date>
    </item>
  </channel>
</rss>

