<?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 extract OS using Regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/659524#M227712</link>
    <description>&lt;P&gt;Hi All...&amp;nbsp;Splunk newbie learning videos, for absolute beginners:&lt;BR /&gt;&lt;A href="https://www.youtube.com/@SiemNewbies101/playlists" target="_blank"&gt;https://www.youtube.com/@SiemNewbies101/playlists&lt;/A&gt;&lt;/P&gt;&lt;P&gt;i have created around 30 small videos on rex particularly.. pls check the playlist, thanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Oct 2023 02:04:56 GMT</pubDate>
    <dc:creator>inventsekar</dc:creator>
    <dc:date>2023-10-04T02:04:56Z</dc:date>
    <item>
      <title>How to extract OS using Regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/658930#M227572</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi, i have lookup which list out all red hat linux. for example, in my lookup have red hat 7, red hat 8 and so on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i need to correlate OS log with the lookup. but my OS log is not standardized as below:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Red Hat Linux Enterprise 7.1,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Red Hat Linux Enterprise Server 8.6 and so on. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;How do i make it as standardized OS as lookup above using regex.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Please assist on this. Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 17:27:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/658930#M227572</guid>
      <dc:creator>Akmal57</dc:creator>
      <dc:date>2023-10-02T17:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extract OS using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/658931#M227573</link>
      <description>&lt;P&gt;It really depends on how you design your "standardized OS". &amp;nbsp;Without a definition, there is no definitive answer. &amp;nbsp;Make no mistake, there are as many ways to "standardize" OS as there are OS's.&lt;/P&gt;&lt;P&gt;If all you need is an OS family name and a major release, and assuming the operating system's full name is in field os. &amp;nbsp;You can do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=os "(?&amp;lt;os_family&amp;gt;Red Hat|Utunbu|Fedora|SuSE)\D+(?&amp;lt;os_maj&amp;gt;\d+)"
| eval os_standard = os_family . " " . os_maj&lt;/LI-CODE&gt;&lt;P&gt;Alternatively,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval os_standard = replace(os, "(Red Hat|Utunbu|Fedora|SuSE)\D+(?&amp;lt;os_maj&amp;gt;\d+).*", "\1 \2")&lt;/LI-CODE&gt;&lt;P&gt;or&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=os mode=sed "s/(Red Hat|Utunbu|Fedora|SuSE)\D+(\d+).*/\1 \2/"&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 05:34:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/658931#M227573</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-09-28T05:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Extract OS using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/658939#M227576</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;, both working perfectly.&lt;/P&gt;&lt;P&gt;but for example there is some os log, the red hat are in middle,&lt;/P&gt;&lt;P&gt;example: Linux(Red Hat Linux Enterprise 7.1) and&amp;nbsp;Linux(Red Hat Linux Enterprise) 8.6&lt;/P&gt;&lt;P&gt;for above log, the regex also detect the linux.&lt;/P&gt;&lt;P&gt;can you assist on regex that cover only red hat and version of it?&lt;/P&gt;&lt;P&gt;also i have same issue on the windows server log which need regex for only detect windows server and which year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 06:25:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/658939#M227576</guid>
      <dc:creator>Akmal57</dc:creator>
      <dc:date>2023-09-28T06:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Extract OS using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/659025#M227603</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;but for example there is some os log, the red hat are in middle,&lt;P&gt;example: Linux(Red Hat Linux Enterprise 7.1) and&amp;nbsp;Linux(Red Hat Linux Enterprise) 8.6&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You mean multiple OS's can appear in the same line? (The above regex doesn't anchor to any position, so the first search shouldn't matter whether it is in the middle.) &amp;nbsp;For this, you can add max_match=0 and use &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions#mvzip.28.26lt.3Bmv_left.26gt.3B.2C.26lt.3Bmv_right.26gt.3B.2C.26lt.3Bdelim.26gt.3B.29" target="_blank" rel="noopener"&gt;mvzip&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=os max_match=0 "(?&amp;lt;os_family&amp;gt;Red Hat|Utunbu|Fedora|SuSE)\D+(?&amp;lt;os_maj&amp;gt;\d+)"
| eval os_standard = mvzip(os_family, os_maj, " ")&lt;/LI-CODE&gt;&lt;P&gt;Here is an emulation that you can play with and compare with real data&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval os = mvappend("Linux(Red Hat Linux Enterprise 7.1) and Linux(Red Hat Linux Enterprise) 8.6",
"Red Hat Linux Enterprise 7.1", "Red Hat Linux Enterprise Server 8.6")
| mvexpand os
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 02:11:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/659025#M227603</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-09-29T02:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract OS using Regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/659522#M227711</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;, its working excellent. Thank you for your assist.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 01:52:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/659522#M227711</guid>
      <dc:creator>Akmal57</dc:creator>
      <dc:date>2023-10-04T01:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract OS using Regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/659524#M227712</link>
      <description>&lt;P&gt;Hi All...&amp;nbsp;Splunk newbie learning videos, for absolute beginners:&lt;BR /&gt;&lt;A href="https://www.youtube.com/@SiemNewbies101/playlists" target="_blank"&gt;https://www.youtube.com/@SiemNewbies101/playlists&lt;/A&gt;&lt;/P&gt;&lt;P&gt;i have created around 30 small videos on rex particularly.. pls check the playlist, thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 02:04:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-OS-using-Regex/m-p/659524#M227712</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2023-10-04T02:04:56Z</dc:date>
    </item>
  </channel>
</rss>

