<?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 How to ignore minor breakers when searching for a term? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707665#M239338</link>
    <description>&lt;P&gt;I've been attempting to see if it's possible to search for a term while ignoring all minor breakers that may or may not be in it. For example, in my case, I'm trying to search for a mac address 12:EA:5F:72:11:AB, but I'd also like to find all instances of&amp;nbsp;12-EA-5F-72-11-AB or&amp;nbsp;12EA.5F72.11AB or even just&amp;nbsp;12EA5F7211AB without needing to deliberately specify each of these variations? I thought I could do it using TERM(), but so far I haven't had any luck, and after reading the docs, I can see I may have misunderstood that command. Is there anyway to do this simply?&lt;/P&gt;</description>
    <pubDate>Sat, 28 Dec 2024 11:47:44 GMT</pubDate>
    <dc:creator>dtaylor</dc:creator>
    <dc:date>2024-12-28T11:47:44Z</dc:date>
    <item>
      <title>How to ignore minor breakers when searching for a term?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707665#M239338</link>
      <description>&lt;P&gt;I've been attempting to see if it's possible to search for a term while ignoring all minor breakers that may or may not be in it. For example, in my case, I'm trying to search for a mac address 12:EA:5F:72:11:AB, but I'd also like to find all instances of&amp;nbsp;12-EA-5F-72-11-AB or&amp;nbsp;12EA.5F72.11AB or even just&amp;nbsp;12EA5F7211AB without needing to deliberately specify each of these variations? I thought I could do it using TERM(), but so far I haven't had any luck, and after reading the docs, I can see I may have misunderstood that command. Is there anyway to do this simply?&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2024 11:47:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707665#M239338</guid>
      <dc:creator>dtaylor</dc:creator>
      <dc:date>2024-12-28T11:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore minor breakers when searching for a term?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707672#M239341</link>
      <description>&lt;P&gt;Since they are indexed as terms split by major and minor breakers, the best you can do is search for all the "minor terms" and use regex to match the particular sequence. Unfortunately it won't work if the original sequence was not split at all or split into larger chunks.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2024 17:19:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707672#M239341</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-12-28T17:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore minor breakers when searching for a term?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707683#M239347</link>
      <description>&lt;P&gt;You don't need to list all the variations, just specify that you don't want the hex characters&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "(?&amp;lt;mac&amp;gt;([0-9A-F]{2}[^0-9A-F]?){5}[0-9A-F]{2})"&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 29 Dec 2024 08:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707683#M239347</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-12-29T08:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore minor breakers when searching for a term?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707685#M239349</link>
      <description>&lt;P&gt;Thank you! While not the solution I was hoping for, this'll get the job done easily enough. I'd actually already considered using the rex command, but wasn't able to get my regex to look neat enough for me to be happy with it.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2024 09:09:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707685#M239349</guid>
      <dc:creator>dtaylor</dc:creator>
      <dc:date>2024-12-29T09:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore minor breakers when searching for a term?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707689#M239352</link>
      <description>&lt;P&gt;Be aware though that it's not _searching_ for particular MAC address - it's extraction. So if you want to find a specific MAC you'll have to firstly extract it with rex _from every event_ and then compare the extracted value with what you're looking for. It's not very effective performance-wise.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2024 11:37:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707689#M239352</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-12-29T11:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore minor breakers when searching for a term?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707691#M239354</link>
      <description>&lt;P&gt;You can use the regex command to filter by a regular expression, but it's slower and more cumbersome than just combining TERM() functions in a search predicate.&lt;/P&gt;&lt;P&gt;As alternatives, you can extract and normalize a&amp;nbsp;&lt;EM&gt;mac&amp;nbsp;&lt;/EM&gt;field at index time with a combination of transforms or you can create a single-field data model that acts as a secondary time series index.&lt;/P&gt;&lt;P&gt;For the latter, create a search-time field extraction using a transform with MV_ADD = true to capture strings that look like MAC addresses matching your 48-bit patterns (xx-xx-xx-xx-xx-xx, xx:xx:xx:xx:xx:xx, and xxxx.xxxx.xxxx). For example, using source type mac_addr:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;# props.conf

[mac_addr]
REPORT-raw_mac = raw_mac

# transforms.conf

[raw_mac]
CLEAN_KEYS = 0
MV_ADD = 1
REGEX = (?&amp;lt;raw_mac&amp;gt;(?&amp;lt;![-.:])\b(?:[0-9A-Fa-f]{2}(?:(?(2)(?:\2)|([-:]?))[0-9A-Fa-f]{2}){5}|[0-9A-Fa-f]{4}(?:(\.)[0-9A-Fa-f]{4}){2})\b(?!\2|\3))&lt;/LI-CODE&gt;&lt;P&gt;Create a subsequent calculated (eval) field that removes separators:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;# props.conf

[mac_addr]
REPORT-raw_mac = raw_mac
EVAL-mac = mvdedup(mvmap(raw_mac, replace(raw_mac, "[-.:]", "")))&lt;/LI-CODE&gt;&lt;P&gt;Then, define and accelerate a data model with a single dataset and field:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;# datamodels.conf

[my_mac_datamodel]
acceleration = true
# 1 month, for example
acceleration.earliest_time = -1mon
acceleration.hunk.dfs_block_size = 0

# data/models/my_mac_datamodel.xml

{
    "modelName": "my_mac_datamodel",
    "displayName": "my_mac_datamodel",
    "description": "",
    "objectSummary": {
        "Event-Based": 0,
        "Transaction-Based": 0,
        "Search-Based": 1
    },
    "objects": [
        {
            "objectName": "my_mac_dataset",
            "displayName": "my_mac_dataset",
            "parentName": "BaseSearch",
            "comment": "",
            "fields": [
                {
                    "fieldName": "mac",
                    "owner": "my_mac_dataset",
                    "type": "string",
                    "fieldSearch": "mac=*",
                    "required": true,
                    "multivalue": false,
                    "hidden": false,
                    "editable": true,
                    "displayName": "mac",
                    "comment": ""
                }
            ],
            "calculations": [],
            "constraints": [],
            "lineage": "my_mac_dataset",
            "baseSearch": "index=main sourcetype=mac_addr"
        }
    ],
    "objectNameList": [
        "my_mac_dataset"
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;All of the above can be added to a search head using SplunkWeb settings in the following order:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Define shared field transformation.&lt;/LI&gt;&lt;LI&gt;Define shared field extraction.&lt;/LI&gt;&lt;LI&gt;Define shared calculated field.&lt;/LI&gt;&lt;LI&gt;Define shared data model.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Finally, use the datamodel command to optimize the search:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| datamodel summariesonly=t my_mac_datamodel my_mac_dataset flat
| search mac=12EA5F7211AB&lt;/LI-CODE&gt;&lt;P&gt;Note that some undocumented conditions (source type renaming?) may force Splunk to disable the optimizations used by the datamodel command when distributing the search, in which case it will be no faster than a regular search of the extracted&amp;nbsp;&lt;EM&gt;mac&lt;/EM&gt; field.&lt;/P&gt;&lt;P&gt;If it's working correctly, the search log should include an optimized search with a READ_SUMMARY directive as well as various&amp;nbsp;ReadSummaryDirective log entries. The datamodel command with the flat argument will return the raw events and the undecorated&amp;nbsp;&lt;EM&gt;mac&lt;/EM&gt; field values, but no other extractions will be performed.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2024 18:08:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-ignore-minor-breakers-when-searching-for-a-term/m-p/707691#M239354</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2024-12-29T18:08:33Z</dc:date>
    </item>
  </channel>
</rss>

