<?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: Combining multiple field values for stats/charting in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692375#M235662</link>
    <description>&lt;P&gt;It's probably my own paranoia but I try not to overwrite a data field like this in case I have to use the original data field for whatever reason. But functionally this would do what I need, I just didn't know if there was a more Splunk-y way to do it.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jul 2024 05:06:35 GMT</pubDate>
    <dc:creator>DATT</dc:creator>
    <dc:date>2024-07-04T05:06:35Z</dc:date>
    <item>
      <title>Combining multiple field values for stats/charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692368#M235659</link>
      <description>&lt;P&gt;I have a field in my data named severity that can be one of five values: 1, 2, 3, 4, and 5.&lt;/P&gt;&lt;P&gt;I want to chart on the following: 1-3, 4, and 5.&amp;nbsp; Anything with a severity value of 3 or lower can be lumped together, but severity 4 and 5 need to be charted separately.&lt;/P&gt;&lt;P&gt;The coalesce command is close but in my case the key is the same, it's the value that changes.&amp;nbsp; None of the mv commands look like they do quite what I need, nor does nomv.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workaround I've considered doing is an eval command with an if statement to say if the severity is 1, 2, or 3, set a new field value to 3, then chart off of this new field.&amp;nbsp; It feels janky, but I think it would give me what I want.&lt;/P&gt;&lt;P&gt;Is it possible to do what I want in a more elegant manner?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 23:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692368#M235659</guid>
      <dc:creator>DATT</dc:creator>
      <dc:date>2024-07-03T23:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple field values for stats/charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692373#M235660</link>
      <description>&lt;P&gt;What's wrong with setting value in the same field? &amp;nbsp;Given this mock data&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Severity&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;and this added to your search,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Severity = if(Severity &amp;lt; 4, "lump", Severity)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will get&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Severity&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lump&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Is this what you are looking for? (By the way, to pose an answerable question, it is always good to post sample/mock data, desired output, and explain the logic between illustrated data and desired output.)&lt;/P&gt;&lt;P&gt;Play with this emulation and compare with real data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="Severity
1
1
5
4
4
3
3
1
1
2
3
2
2"
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 03:25:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692373#M235660</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-07-04T03:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple field values for stats/charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692374#M235661</link>
      <description>&lt;P&gt;You can use rangemap simply&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=100
| eval severity=random() % 5 + 1
| rangemap field=severity low=1-3 medium=4-4 high=5-5&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Jul 2024 04:31:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692374#M235661</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-07-04T04:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple field values for stats/charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692375#M235662</link>
      <description>&lt;P&gt;It's probably my own paranoia but I try not to overwrite a data field like this in case I have to use the original data field for whatever reason. But functionally this would do what I need, I just didn't know if there was a more Splunk-y way to do it.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 05:06:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692375#M235662</guid>
      <dc:creator>DATT</dc:creator>
      <dc:date>2024-07-04T05:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple field values for stats/charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692384#M235663</link>
      <description>&lt;P&gt;You can do it by overwriting the field, or just create a new field or use the rangemap, there are so many ways to do it - you can also use fieldformat, which will display a value, but retain the original - see this example how after the stats, the severity retains its numerical value and also the stats will still split by the different numerical values.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=100
| eval severity=random() % 5 + 1
| rangemap field=severity low=1-3 medium=4-4 high=5-5
| fieldformat severity=case(severity&amp;lt;=3, "low", severity=4, "medium", severity=5, "high")
| stats count by severity
| eval x=severity&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Jul 2024 07:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-field-values-for-stats-charting/m-p/692384#M235663</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-07-04T07:28:35Z</dc:date>
    </item>
  </channel>
</rss>

