<?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 rex for dynamic parttern in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536179#M151599</link>
    <description>&lt;P&gt;Hi, I have a raw log with structure like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TIME|FROM|TO|URL|ERROR|STATUS|ALERT&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Wed Jan 6 15:10:01 2021|Department A|Department B|www.abc.com|0|Connected|Call Department C&lt;/LI-CODE&gt;&lt;P&gt;I want to use rex to dissect them to their own fields like TIME, FROM, TO, etc... But the thing is every fields in the log are dynamic, meaning they don't always stay the same. I pretty new to regular expression and splunk so I don't know how to operate this.&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jan 2021 09:10:35 GMT</pubDate>
    <dc:creator>phamxuantung</dc:creator>
    <dc:date>2021-01-18T09:10:35Z</dc:date>
    <item>
      <title>rex for dynamic parttern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536179#M151599</link>
      <description>&lt;P&gt;Hi, I have a raw log with structure like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TIME|FROM|TO|URL|ERROR|STATUS|ALERT&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Wed Jan 6 15:10:01 2021|Department A|Department B|www.abc.com|0|Connected|Call Department C&lt;/LI-CODE&gt;&lt;P&gt;I want to use rex to dissect them to their own fields like TIME, FROM, TO, etc... But the thing is every fields in the log are dynamic, meaning they don't always stay the same. I pretty new to regular expression and splunk so I don't know how to operate this.&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 09:10:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536179#M151599</guid>
      <dc:creator>phamxuantung</dc:creator>
      <dc:date>2021-01-18T09:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: rex for dynamic parttern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536187#M151602</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230393"&gt;@phamxuantung&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand: the problem is that the order of the fields is changing or that some field sometimes is missing?&lt;/P&gt;&lt;P&gt;is it possible to define some additional rules for the values or the format of the fields (e.g.: STATUS can be only "Connected" or "disconnected"; FROM and TO starts always with "Department"; etc...)?&lt;/P&gt;&lt;P&gt;If you can define some rules it's possible to read the fields, otherwise it's difficoult.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 10:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536187#M151602</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-01-18T10:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: rex for dynamic parttern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536213#M151611</link>
      <description>&lt;P&gt;It depends what you mean by dynamic. Does this work for you?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "(?P&amp;lt;TIME&amp;gt;[^\|]*)\|(?P&amp;lt;FROM&amp;gt;[^\|]*)\|(?P&amp;lt;TO&amp;gt;[^\|]*)\|(?P&amp;lt;URL&amp;gt;[^\|]*)\|(?P&amp;lt;ERROR&amp;gt;[^\|]*)\|(?P&amp;lt;STATUS&amp;gt;[^\|]*)\|(?P&amp;lt;ALERT&amp;gt;.*)"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 18 Jan 2021 13:49:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536213#M151611</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-01-18T13:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: rex for dynamic parttern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536279#M151623</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;The problem is the values of the field are changing, with varied length, The rule is the order and they separate with |. Detail of each field would be:&lt;/P&gt;&lt;P&gt;TIME: The time of the events.&lt;/P&gt;&lt;P&gt;FROM|TO: Name of the Gateway, you can think of them like people name, and they have a set of 10 values or so.&lt;/P&gt;&lt;P&gt;URL: The URL of the connected service - The only field that have a static start pattern ("http:"), but the content varied from a web address that end with ".com" or an IP address like 192.168.1.1.&lt;/P&gt;&lt;P&gt;ERROR: Between 0 and 1 whereas 0 is Connected and 1 is Error.&lt;/P&gt;&lt;P&gt;STATUS: "Connecting to" above URL...connected/error.&lt;/P&gt;&lt;P&gt;ALERT: always stay the same, "Call IT", but I would like to also take it out in case there might be more in the future.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 02:36:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536279#M151623</guid>
      <dc:creator>phamxuantung</dc:creator>
      <dc:date>2021-01-19T02:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: rex for dynamic parttern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536295#M151631</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230393"&gt;@phamxuantung&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if the order is always the same, it's easy:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "^(?&amp;lt;TIME&amp;gt;[^\|]+)\|(?&amp;lt;FROM&amp;gt;[^\|]+)\|(?&amp;lt;TO&amp;gt;[^\|]+)\|(?&amp;lt;URL&amp;gt;[^\|]+)\|(?&amp;lt;ERROR&amp;gt;[^\|]+)\|(?&amp;lt;STATUS&amp;gt;[^\|]+)\|(?&amp;lt;ALERT&amp;gt;.+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can test the regex at &lt;A href="https://regex101.com/r/6pQnRw/1" target="_blank"&gt;https://regex101.com/r/6pQnRw/1&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 07:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/536295#M151631</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-01-19T07:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: rex for dynamic parttern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/540357#M152870</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230393"&gt;@phamxuantung&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by alla contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 09:21:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-for-dynamic-parttern/m-p/540357#M152870</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-18T09:21:43Z</dc:date>
    </item>
  </channel>
</rss>

