<?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 Count by two different fields in one result in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-by-two-different-fields-in-one-result/m-p/649984#M224727</link>
    <description>&lt;P&gt;Hello all, i'm sure tje answer exists somewhere but i can't find it...&lt;BR /&gt;As you can see, i start with this powerfull tool, and i need help.&lt;BR /&gt;I have logs with FIELD1 and FIELD2 which concern the samething (IP ADDRESS).&lt;BR /&gt;I need to chart a count of each line of log where&amp;nbsp;FIELD1="A" OR FIELD2="B" in a bargraph by FIELD1 and FIELD2.&lt;BR /&gt;&lt;BR /&gt;So to see count of log by IP Address (which are in two differents fields.&lt;BR /&gt;I hope i'm&amp;nbsp;&lt;SPAN class=""&gt;understandable...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I stoped here (that display only count for the field i count by)...&lt;/P&gt;&lt;P&gt;index="XXX" FIELD1="A" OR FIELD2="B" | chart count(eval(FIELD1="A")) AS "AnswerA", count(eval(FIELD2="B")) as "AnswerB" by ???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jul 2023 13:12:00 GMT</pubDate>
    <dc:creator>humi</dc:creator>
    <dc:date>2023-07-11T13:12:00Z</dc:date>
    <item>
      <title>Count by two different fields in one result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-by-two-different-fields-in-one-result/m-p/649984#M224727</link>
      <description>&lt;P&gt;Hello all, i'm sure tje answer exists somewhere but i can't find it...&lt;BR /&gt;As you can see, i start with this powerfull tool, and i need help.&lt;BR /&gt;I have logs with FIELD1 and FIELD2 which concern the samething (IP ADDRESS).&lt;BR /&gt;I need to chart a count of each line of log where&amp;nbsp;FIELD1="A" OR FIELD2="B" in a bargraph by FIELD1 and FIELD2.&lt;BR /&gt;&lt;BR /&gt;So to see count of log by IP Address (which are in two differents fields.&lt;BR /&gt;I hope i'm&amp;nbsp;&lt;SPAN class=""&gt;understandable...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I stoped here (that display only count for the field i count by)...&lt;/P&gt;&lt;P&gt;index="XXX" FIELD1="A" OR FIELD2="B" | chart count(eval(FIELD1="A")) AS "AnswerA", count(eval(FIELD2="B")) as "AnswerB" by ???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 13:12:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-by-two-different-fields-in-one-result/m-p/649984#M224727</guid>
      <dc:creator>humi</dc:creator>
      <dc:date>2023-07-11T13:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count by two different fields in one result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-by-two-different-fields-in-one-result/m-p/649985#M224728</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258561"&gt;@humi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if you have some events only with field1 and some events only with field2, you could aggregate the values from field1 and field2 in the same field and use it:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="XXX" (FIELD1=* OR FIELD2=*) 
| eval IP=coalesce(FIELD1, FIELD2)
| chart count BY IP&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 13:19:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-by-two-different-fields-in-one-result/m-p/649985#M224728</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-11T13:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count by two different fields in one result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-by-two-different-fields-in-one-result/m-p/649998#M224730</link>
      <description>&lt;P&gt;Thanks Giuseppe !&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's so simple when the solution is given...&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 14:38:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-by-two-different-fields-in-one-result/m-p/649998#M224730</guid>
      <dc:creator>humi</dc:creator>
      <dc:date>2023-07-11T14:38:48Z</dc:date>
    </item>
  </channel>
</rss>

