<?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: Search for the biggest number in a field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-for-the-biggest-number-in-a-field/m-p/171972#M49288</link>
    <description>&lt;P&gt;Thank you, it helped me.&lt;BR /&gt;
I don't manage how I can search only in one field. The recipient0 etc. occurs also in other fields in the log, so I'd have to adapt the regex or try it with a subsearch.&lt;BR /&gt;
And would it be good to change the regex so it does only match 1 diggit after "recipient" ? Or does it only "operate" with numbers, since we calculate with it afterwards?&lt;/P&gt;</description>
    <pubDate>Tue, 10 Mar 2015 10:25:47 GMT</pubDate>
    <dc:creator>hofer</dc:creator>
    <dc:date>2015-03-10T10:25:47Z</dc:date>
    <item>
      <title>Search for the biggest number in a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-the-biggest-number-in-a-field/m-p/171970#M49286</link>
      <description>&lt;P&gt;I've got a long csv and extracted the fields. Now in one field, there's more than one information.&lt;BR /&gt;
Depending on how many recipients a message is for, the more recipients are logged. Format like:&lt;/P&gt;

&lt;P&gt;...|{}|{"...","..","recipient0":"01234567","recipient1":"09877543","recipient2":"151617189",....,"recipient8":"41790042325","IP":1.1.1.1","..."}|{}|...|&lt;BR /&gt;
...|{}|{"...","..","recipient0":"05974567","recipient1":"09877543","recipient2":"151617199","IP":1.1.1.1","..."}|{}|...|&lt;/P&gt;

&lt;P&gt;So "recipient0" is always, there are at max 10 recipients (0-9). I'd like to have a timechart on how many recipients a message got, so I'm searching for a command to find the "highest" recipient.&lt;/P&gt;

&lt;P&gt;I hope my question is understandable and you can help me, many thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2015 08:10:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-the-biggest-number-in-a-field/m-p/171970#M49286</guid>
      <dc:creator>hofer</dc:creator>
      <dc:date>2015-03-10T08:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Search for the biggest number in a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-the-biggest-number-in-a-field/m-p/171971#M49287</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;you can try it with something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex max_match=0 "recipient(?&amp;lt;counter&amp;gt;\d)" | eval max_result = max('counter') + 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The rex command extracts the number of the recipient fields in a multi value field. Then you use max to get the maximum. Because the fields are numbered from 0 to 9, you might want to add a "+ 1" to the eval command for the correct count.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2015 08:54:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-the-biggest-number-in-a-field/m-p/171971#M49287</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2015-03-10T08:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search for the biggest number in a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-the-biggest-number-in-a-field/m-p/171972#M49288</link>
      <description>&lt;P&gt;Thank you, it helped me.&lt;BR /&gt;
I don't manage how I can search only in one field. The recipient0 etc. occurs also in other fields in the log, so I'd have to adapt the regex or try it with a subsearch.&lt;BR /&gt;
And would it be good to change the regex so it does only match 1 diggit after "recipient" ? Or does it only "operate" with numbers, since we calculate with it afterwards?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2015 10:25:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-the-biggest-number-in-a-field/m-p/171972#M49288</guid>
      <dc:creator>hofer</dc:creator>
      <dc:date>2015-03-10T10:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search for the biggest number in a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-for-the-biggest-number-in-a-field/m-p/171973#M49289</link>
      <description>&lt;P&gt;Yeah, so you can use a rex command to first to make a field that contains only the recipient of interest. For example a regex that extracts&lt;/P&gt;

&lt;P&gt;{"...","..","recipient0":"01234567","recipient1":"09877543","recipient2":"151617189",....,"recipient8":"41790042325","IP":1.1.1.1","..."}&lt;/P&gt;

&lt;P&gt;out of &lt;/P&gt;

&lt;P&gt;...|{ other log data with recipients in it}|{"...","..","recipient0":"01234567","recipient1":"09877543","recipient2":"151617189",....,"recipient8":"41790042325","IP":1.1.1.1","..."}|{ more log data with recipients in it}|...|&lt;/P&gt;

&lt;P&gt;and then use the rex from my first anwer only on this field.&lt;/P&gt;

&lt;P&gt;"would it be good to change the regex so it does only match 1 diggit after "recipient" -&amp;gt; It already does only match one digit after recipients, since i only used \d and not \d+ or \d*, where \d stands for a single digit.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2015 11:24:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-for-the-biggest-number-in-a-field/m-p/171973#M49289</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2015-03-10T11:24:03Z</dc:date>
    </item>
  </channel>
</rss>

