<?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 split string in splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-split-string-in-splunk/m-p/533161#M150641</link>
    <description>&lt;P&gt;Hi @all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have following string which i want to break into there fields: service_name, host and port_id&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;STRONG&gt;metics-ha-5924590-011.aba.corp.tyos.com:2002&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;service_name = metics&lt;/P&gt;&lt;P&gt;host =&amp;nbsp;ha-5924590-011.aba.corp.tyos.com&lt;/P&gt;&lt;P&gt;port =&amp;nbsp;2002&lt;BR /&gt;anyone please help me, how can i do it in splunk query.&lt;BR /&gt;&lt;BR /&gt;Thanks !!&lt;/P&gt;</description>
    <pubDate>Tue, 15 Dec 2020 14:41:15 GMT</pubDate>
    <dc:creator>Khushboo</dc:creator>
    <dc:date>2020-12-15T14:41:15Z</dc:date>
    <item>
      <title>how to split string in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-split-string-in-splunk/m-p/533161#M150641</link>
      <description>&lt;P&gt;Hi @all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have following string which i want to break into there fields: service_name, host and port_id&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;STRONG&gt;metics-ha-5924590-011.aba.corp.tyos.com:2002&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;service_name = metics&lt;/P&gt;&lt;P&gt;host =&amp;nbsp;ha-5924590-011.aba.corp.tyos.com&lt;/P&gt;&lt;P&gt;port =&amp;nbsp;2002&lt;BR /&gt;anyone please help me, how can i do it in splunk query.&lt;BR /&gt;&lt;BR /&gt;Thanks !!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 14:41:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-split-string-in-splunk/m-p/533161#M150641</guid>
      <dc:creator>Khushboo</dc:creator>
      <dc:date>2020-12-15T14:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to split string in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-split-string-in-splunk/m-p/533167#M150645</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229751"&gt;@Khushboo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Please, try this regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "(?&amp;lt;service_name&amp;gt;[^-]+)-(?&amp;lt;host&amp;gt;[^:]+):(?&amp;lt;port&amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;tha you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/wkUHCx/1" target="_blank"&gt;https://regex101.com/r/wkUHCx/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 15:03:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-split-string-in-splunk/m-p/533167#M150645</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-12-15T15:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to split string in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-split-string-in-splunk/m-p/533172#M150647</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;BR /&gt;In my case all the variables like service_name, host and port are dynamic. so i cant hard-coded that.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 15:23:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-split-string-in-splunk/m-p/533172#M150647</guid>
      <dc:creator>Khushboo</dc:creator>
      <dc:date>2020-12-15T15:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to split string in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-split-string-in-splunk/m-p/533176#M150649</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229751"&gt;@Khushboo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you have to define a rule to extract fields:&lt;/P&gt;&lt;P&gt;if you cadn define that:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;from the beginning to the first "-" it's the "&lt;SPAN&gt;service_name",&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;from the service_name to ":" it's the host,&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;after there's the port;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;this regex can work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In other words if you can define a rule, you can use a regex otherwise you cannot!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ciao.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Giuseppe&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 15:27:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-split-string-in-splunk/m-p/533176#M150649</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-12-15T15:27:33Z</dc:date>
    </item>
  </channel>
</rss>

