<?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: How do I compare the count of the same field from different sources? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381618#M68831</link>
    <description>&lt;P&gt;Use some conditional logic like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval count_source_one=if(SOURCE1=source1, 'count',"")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 20 Nov 2018 03:35:41 GMT</pubDate>
    <dc:creator>skoelpin</dc:creator>
    <dc:date>2018-11-20T03:35:41Z</dc:date>
    <item>
      <title>How do I compare the count of the same field from different sources?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381617#M68830</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Now I have a problem:&lt;/P&gt;

&lt;P&gt;I have a  index data  which has multiple sources and they have the same sourcetype.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=t_web sourcetype=t_web_pect
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;source such as :&lt;BR /&gt;
    t_we_a1.txt  ,t_we_a2.txt , t_we_a3.txt&lt;BR /&gt;
They have the same fields, because of source type fields such as: scan_system_name  scan_level.&lt;/P&gt;

&lt;P&gt;Different sources may have the same &lt;CODE&gt;scan_system_name&lt;/CODE&gt;&lt;BR /&gt;
now I want to get a table ,such as :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sys_Name  number of recent scan_level   number of recent scan_level   Compared with the last scan 
name1         66                            60                       More than the last one
name2          57                           68                       Fewer than the last one
name3          34                           34                      The number has't changed
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;name1 may in multiple sources. I just need to get the same system name.&lt;/P&gt;

&lt;P&gt;What should I do?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381617#M68830</guid>
      <dc:creator>WXY</dc:creator>
      <dc:date>2020-09-29T21:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare the count of the same field from different sources?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381618#M68831</link>
      <description>&lt;P&gt;Use some conditional logic like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval count_source_one=if(SOURCE1=source1, 'count',"")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Nov 2018 03:35:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381618#M68831</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-11-20T03:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare the count of the same field from different sources?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381619#M68832</link>
      <description>&lt;P&gt;I do not understand your situation.  If you will give a small set of sample data and the desired output (perhaps with commentary on how the normal way of doing it would give the wrong output and show the wrong output), then I will try to help.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Nov 2018 16:16:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381619#M68832</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-11-24T16:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare the count of the same field from different sources?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381620#M68833</link>
      <description>&lt;P&gt;hi @WXY&lt;/P&gt;

&lt;P&gt;Are you still having trouble with this issue? If so, please answer the commenter above so that they can help you further. There is also an answer below — did you try out their solution? Or, if you solved your query on your own, please describe the steps you took so that others can learn from your solution.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 19:25:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381620#M68833</guid>
      <dc:creator>mstjohn_splunk</dc:creator>
      <dc:date>2018-11-27T19:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare the count of the same field from different sources?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381621#M68834</link>
      <description>&lt;P&gt;I have solved this problem：&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=t_web
| stats count(scan_level) as levelcount by scan_system_name  _time 
| streamstats latest(levelcount) as a by scan_system_name  current=f 
| fillnull value=0 a 
| eval aa = levelcount-a 
| stats latest(_time) as _time latest(a) as lastCount latest(levelcount) as finalScan  count as scanCount latest(aa) as ComparedWithLast by scan_system_name
| eval ComparedWithLast  = CASE ( 'scanCount'==1, "Only Scan One", ('scanCount'&amp;gt;1 and 'ComparedWithLast'&amp;gt;0), "More than the last one", 'ComparedWithLast'&amp;lt;0, "Fewer than the last one", ('scanCount'&amp;gt;1 and 'ComparedWithLast'==0), "The number has't changed")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 02:40:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-compare-the-count-of-the-same-field-from-different/m-p/381621#M68834</guid>
      <dc:creator>WXY</dc:creator>
      <dc:date>2018-11-29T02:40:32Z</dc:date>
    </item>
  </channel>
</rss>

