<?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 Converting from multiline field in table of result by stats values() to one line results after geoip... why? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Converting-from-multiline-field-in-table-of-result-by-stats/m-p/55403#M10805</link>
    <description>&lt;P&gt;search 1 : &lt;BR /&gt;
index=web_access_log &lt;BR /&gt;
| stats values(src_ip) as web_src_ip, count by dst_ip&lt;/P&gt;

&lt;P&gt;search1's results :&lt;/P&gt;

&lt;H2&gt;web_src_ip             dst_ip&lt;/H2&gt;

&lt;P&gt;123.123.123.123        111.111.111.111&lt;BR /&gt;
234.234.234.234&lt;/P&gt;

&lt;H2&gt;345.345.345.345&lt;/H2&gt;

&lt;P&gt;search 2 : &lt;BR /&gt;
index=web_access_log &lt;BR /&gt;
| stats values(src_ip) as web_src_ip, count by dst_ip&lt;BR /&gt;
| geoip dst_ip&lt;/P&gt;

&lt;P&gt;search2's results&lt;/P&gt;

&lt;H2&gt;web_src_ip                                                       dst_ip             dst_ip_country_name&lt;/H2&gt;

&lt;P&gt;123.123.123.123 234.234.234.234 345.345.345.345        111.111.111.111    country_name&lt;/P&gt;

&lt;P&gt;After applying geoip command, the result of search2 shows in single-line form.&lt;BR /&gt;
However, what I really wanted to show is to use geoip to result in multi-line form.&lt;BR /&gt;
So, any suggestion? How can that be done?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 13:28:29 GMT</pubDate>
    <dc:creator>joy76</dc:creator>
    <dc:date>2020-09-28T13:28:29Z</dc:date>
    <item>
      <title>Converting from multiline field in table of result by stats values() to one line results after geoip... why?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Converting-from-multiline-field-in-table-of-result-by-stats/m-p/55403#M10805</link>
      <description>&lt;P&gt;search 1 : &lt;BR /&gt;
index=web_access_log &lt;BR /&gt;
| stats values(src_ip) as web_src_ip, count by dst_ip&lt;/P&gt;

&lt;P&gt;search1's results :&lt;/P&gt;

&lt;H2&gt;web_src_ip             dst_ip&lt;/H2&gt;

&lt;P&gt;123.123.123.123        111.111.111.111&lt;BR /&gt;
234.234.234.234&lt;/P&gt;

&lt;H2&gt;345.345.345.345&lt;/H2&gt;

&lt;P&gt;search 2 : &lt;BR /&gt;
index=web_access_log &lt;BR /&gt;
| stats values(src_ip) as web_src_ip, count by dst_ip&lt;BR /&gt;
| geoip dst_ip&lt;/P&gt;

&lt;P&gt;search2's results&lt;/P&gt;

&lt;H2&gt;web_src_ip                                                       dst_ip             dst_ip_country_name&lt;/H2&gt;

&lt;P&gt;123.123.123.123 234.234.234.234 345.345.345.345        111.111.111.111    country_name&lt;/P&gt;

&lt;P&gt;After applying geoip command, the result of search2 shows in single-line form.&lt;BR /&gt;
However, what I really wanted to show is to use geoip to result in multi-line form.&lt;BR /&gt;
So, any suggestion? How can that be done?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:28:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Converting-from-multiline-field-in-table-of-result-by-stats/m-p/55403#M10805</guid>
      <dc:creator>joy76</dc:creator>
      <dc:date>2020-09-28T13:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Converting from multiline field in table of result by stats values() to one line results after geoip... why?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Converting-from-multiline-field-in-table-of-result-by-stats/m-p/55404#M10806</link>
      <description>&lt;P&gt;geoip is a python command and I think it can be tricky to get a python command to handle multivalue fields correctly.  This might be thus a problem in geoip, but I don't know for sure.  At any rate,  you can cheat! &lt;/P&gt;

&lt;P&gt;use streamstats to paint a row number,  use mvexpand to blow out the N x mv fields into N rows of single value fields, wash through geoip,  then do stats values by rowIndex to compact it back into your mv form. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=web_access_log 
| stats values(src_ip) as web_src_ip, count by dst_ip
| streamstats count as rowIndex
| mvexpand web_src_ip
| geoip dst_ip
| stats values(web_src_ip) as web_src_ip values(dst_ip) as dst_ip values(dst_ip_country_name) as dst_ip_country_name by rowIndex
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can strip off the last few pipes and run it pipe by pipe and that'll help you understand how it works. &lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2013 05:55:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Converting-from-multiline-field-in-table-of-result-by-stats/m-p/55404#M10806</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-03-08T05:55:11Z</dc:date>
    </item>
  </channel>
</rss>

