<?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 to edit my search to rename the legend IP to a CIDR nickname in the resulting bar chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-rename-the-legend-IP-to-a-CIDR-nickname/m-p/334469#M99401</link>
    <description>&lt;P&gt;thanks for the assist team, works great&lt;/P&gt;</description>
    <pubDate>Sun, 05 Mar 2017 19:41:32 GMT</pubDate>
    <dc:creator>loudainmarc</dc:creator>
    <dc:date>2017-03-05T19:41:32Z</dc:date>
    <item>
      <title>How to edit my search to rename the legend IP to a CIDR nickname in the resulting bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-rename-the-legend-IP-to-a-CIDR-nickname/m-p/334466#M99398</link>
      <description>&lt;P&gt;my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;src_ip=CIDR1 OR src_ip=CIDR2 OR src_ip=CIDR3 dest_ip=* | timechart count(src_port) by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;now, the resulting bar graph is good but the legend shows the specific IP, but i want to replace that specific IP (in the legend) with a nickname of the CIDR which it came from...how?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 02:19:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-rename-the-legend-IP-to-a-CIDR-nickname/m-p/334466#M99398</guid>
      <dc:creator>loudainmarc</dc:creator>
      <dc:date>2017-03-03T02:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to rename the legend IP to a CIDR nickname in the resulting bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-rename-the-legend-IP-to-a-CIDR-nickname/m-p/334467#M99399</link>
      <description>&lt;P&gt;Here's one way, if your src_ips and nicknames are relatively static, you can put them inline in the search using this method...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| join type=left src_ip [|makeresults | eval mylookup="CIDR1,My CIDR1 nickname!!!!CIDR2,My CIDR2 nickname!!!!CIDR3,My CIDR3 nickname" | makemv delim="!!!!" mylookup | mvexpand mylookup |makemv delim="," mylookup | eval src_ip=mvindex(mylookup,0),src_ip_nickname=mvindex(mylookup,1)| table src_ip src_ip_nickname]
| table _time src_ip src_ip_nickname src_port
| timechart count(src_port) by src_ip_nickname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The format for each individual lookup is... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;src_ip[comma]nickname with spaces allowed[four exclamation points]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For a larger set of IPs, you'll want to use inputlookup or inputcsv instead of this method.  If you establish a lookup table named mylookup.csv with columns src_ip  and src_ip_nickname&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| join type=left src_ip [|inputcsv mylookup.csv]
| table _time src_ip src_ip_nickname src_port
| timechart count(src_port) by src_ip_nickname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;For the curious, this code generates some test data for the above code...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start="01/25/2017:23:00:00" end="01/27/2017:01:00:00" increment=23m 
| streamstats count as baseEvent | eval series="CIDR1"
| append[| gentimes start="01/26/2017:03:00:00" end="01/26/2017:21:00:00" increment=47m | streamstats count as baseEvent | eval series="CIDR2"]
| append[| gentimes start="01/26/2017:01:17:00" end="01/26/2017:23:18:00" increment=21m | streamstats count as baseEvent | eval series="CIDR3"]
| eval rand1 = random()
| eval adder1 = tonumber(substr(tostring(rand1),1,4))
| eval adder2 = tonumber(substr(tostring(rand1),max(len(rand1)-4,3),4))
| eval sometimes=mvappend(tostring(starttime),tostring(starttime+adder1),tostring(starttime+adder2))
| mvexpand sometimes 
| eval _time=sometimes 
| eval rand2 = random() 
| eval value=substr(rand2,len(rand2)-2,2)
| eval rand3 = random()
| eval src_port= case(rand3&amp;gt;1800000000,"foo11",rand3&amp;gt;1200000000,"foo12",rand3&amp;gt;600000000,"foo13",true(),"foo14")
| rename series as src_ip
| table _time src_ip src_port
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:06:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-rename-the-legend-IP-to-a-CIDR-nickname/m-p/334467#M99399</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-09-29T13:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to rename the legend IP to a CIDR nickname in the resulting bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-rename-the-legend-IP-to-a-CIDR-nickname/m-p/334468#M99400</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;src_ip=CIDR1 OR src_ip=CIDR2 OR src_ip=CIDR3 dest_ip=* 
| eval src_ip=case(cidrmatch("CIDR1",src_ip),"CIDR1",cidrmatch("CIDR2",src_ip),"CIDR2",1=1,"CIDR3")  
| timechart count(src_port) by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Mar 2017 15:33:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-rename-the-legend-IP-to-a-CIDR-nickname/m-p/334468#M99400</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-03T15:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to rename the legend IP to a CIDR nickname in the resulting bar chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-rename-the-legend-IP-to-a-CIDR-nickname/m-p/334469#M99401</link>
      <description>&lt;P&gt;thanks for the assist team, works great&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 19:41:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-rename-the-legend-IP-to-a-CIDR-nickname/m-p/334469#M99401</guid>
      <dc:creator>loudainmarc</dc:creator>
      <dc:date>2017-03-05T19:41:32Z</dc:date>
    </item>
  </channel>
</rss>

