<?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: Reformat MAC address in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/597671#M208093</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/73532"&gt;@CyberSekure&lt;/a&gt;- this is a great approach. I wrapped this into a macro and use it all the time now!&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2022 18:08:41 GMT</pubDate>
    <dc:creator>ejwade</dc:creator>
    <dc:date>2022-05-12T18:08:41Z</dc:date>
    <item>
      <title>How to reformat MAC address?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113534#M29888</link>
      <description>&lt;P&gt;I need help reformatting a MAC address field which doesn't have colons to add them.&lt;/P&gt;
&lt;P&gt;MAC=123456781122&lt;BR /&gt;desired format = 12:34:56:78:11:22&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 18:10:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113534#M29888</guid>
      <dc:creator>kevinjacks</dc:creator>
      <dc:date>2022-05-12T18:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat MAC address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113535#M29889</link>
      <description>&lt;P&gt;Hmm. I think this is just one way you could do it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval m = tostring(MAC)
| eval MAC = substr(m, 0,2).":".substr(m,2,4).":".substr(m,4,6).":".substr(m,6,8).":".substr(m,8,10).":".substr(m,10)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Jul 2015 20:33:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113535#M29889</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-07-10T20:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat MAC address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113536#M29890</link>
      <description>&lt;P&gt;you had a typo in there but I see what you're doing.  thanks for the help!&lt;/P&gt;

&lt;P&gt;this worked:&lt;/P&gt;

&lt;P&gt;| eval m = tostring(MAC)&lt;BR /&gt;
| eval MAC2 = substr(m,1,2).":".substr(m,3,2).":".substr(m,5,2).":".substr(m,7,2).":".substr(m,9,2).":".substr(m,11,2)&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2015 20:50:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113536#M29890</guid>
      <dc:creator>kevinjacks</dc:creator>
      <dc:date>2015-07-10T20:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat MAC address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113537#M29891</link>
      <description>&lt;P&gt;Realise this is a bit late, but came across the same problem and found the below to work as well - might be a bit faster as it's just using one eval?&lt;/P&gt;

&lt;P&gt;| eval MAC=replace(MAC, "(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})", "\1:\2:\3:\4:\5:\6")&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 14:41:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113537#M29891</guid>
      <dc:creator>CyberSekure</dc:creator>
      <dc:date>2017-11-23T14:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat MAC address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113538#M29892</link>
      <description>&lt;P&gt;Hi guys, I'm trying to accomplish the same thing and something is not working, I only get the first MAC address to show up once I create the table, it formats it correctly but it's not what I want.&lt;/P&gt;

&lt;P&gt;sourcetype="corp16arp:mib" | rex "ipNetToMediaPhysAddress.\"\d+\".\"(?\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\"\s+=\s+\"0x(?\w+)" max_match=0 | eval m = tostring(MAC)&lt;BR /&gt;
     | eval MAC = substr(m,0,2).":".substr(m,3,2).":".substr(m,5,2).":".substr(m,7,2).":".substr(m,9,2).":".substr(m,11,2) | table IP MAC&lt;/P&gt;

&lt;P&gt;The following regex takes raw SNMP data and creates two fields, IP and MAC: I omitted the full IP and MAC's for security reasons. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;RFC1213-MIB::ipNetToMediaPhysAddress."14"."53.x.x.x" = "0x000000000000" RFC1213-MIB::ipNetToMediaPhysAddress."14"."53.x.x.x" = "0x000000000000" RFC1213-MIB::ipNetToMediaPhysAddress."51"."53.x.x.x" = "0x000000000000" RFC1213-MIB::ipNetToMediaPhysAddress."51"."53.x.x.x" = "0x000000000000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any advice on this would help. &lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 22:52:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113538#M29892</guid>
      <dc:creator>pzharyuk</dc:creator>
      <dc:date>2018-02-09T22:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat MAC address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113539#M29893</link>
      <description>&lt;P&gt;Hi @pzharyuk&lt;/P&gt;

&lt;P&gt;This question was posted in 2015. If the accepted answer is not working out for you, please post it as a new question so you can get better exposure to your question.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 22:58:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/113539#M29893</guid>
      <dc:creator>Anam</dc:creator>
      <dc:date>2018-02-09T22:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat MAC address</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/597671#M208093</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/73532"&gt;@CyberSekure&lt;/a&gt;- this is a great approach. I wrapped this into a macro and use it all the time now!&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 18:08:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-reformat-MAC-address/m-p/597671#M208093</guid>
      <dc:creator>ejwade</dc:creator>
      <dc:date>2022-05-12T18:08:41Z</dc:date>
    </item>
  </channel>
</rss>

