<?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 do you use regex on 2 fields and combine them into one field for an xyseries? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419854#M120720</link>
    <description>&lt;P&gt;Hi @prakash007,&lt;/P&gt;

&lt;P&gt;Thanks for reply, it is not working.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Dec 2018 06:42:37 GMT</pubDate>
    <dc:creator>krusovice</dc:creator>
    <dc:date>2018-12-05T06:42:37Z</dc:date>
    <item>
      <title>How do you use regex on 2 fields and combine them into one field for an xyseries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419852#M120718</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have a simple regex to extract 2 fields — name1 and name2. And I would need to combine it like this: name1.name2 and send it to xyseries as one name. I can't make it work with the below query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "line1\=(?&amp;lt;name1&amp;gt;[\w+]+)" 
| rex "line2\=(?&amp;lt;name2&amp;gt;[\w+]+)"
| eval fullname=name1.name2
| xyseries fullname date_hour count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Could someone please help me? Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 02:45:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419852#M120718</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-12-05T02:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use regex on 2 fields and combine them into one field for an xyseries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419853#M120719</link>
      <description>&lt;P&gt;How about this..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "line1\=(?&amp;lt;name1&amp;gt;[\w+]+)" 
| rex "line2\=(?&amp;lt;name2&amp;gt;[\w+]+)"
| eval fullname=name1." ".name2
| xyseries fullname date_hour count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Dec 2018 03:36:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419853#M120719</guid>
      <dc:creator>prakash007</dc:creator>
      <dc:date>2018-12-05T03:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use regex on 2 fields and combine them into one field for an xyseries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419854#M120720</link>
      <description>&lt;P&gt;Hi @prakash007,&lt;/P&gt;

&lt;P&gt;Thanks for reply, it is not working.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 06:42:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419854#M120720</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-12-05T06:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use regex on 2 fields and combine them into one field for an xyseries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419855#M120721</link>
      <description>&lt;P&gt;@krusovice &lt;/P&gt;

&lt;P&gt;Can you please share you sample events?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 07:18:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419855#M120721</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-12-05T07:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use regex on 2 fields and combine them into one field for an xyseries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419856#M120722</link>
      <description>&lt;P&gt;raw data like this:&lt;/P&gt;

&lt;P&gt;line1=aaa&lt;BR /&gt;
line2=yyy&lt;/P&gt;

&lt;P&gt;Expected fullname should be aaa.yyy in x-axis of the table.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 07:34:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419856#M120722</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-12-05T07:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use regex on 2 fields and combine them into one field for an xyseries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419857#M120723</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;most probably you have some NULL values. Use &lt;CODE&gt;fillnull&lt;/CODE&gt; with an appropriate value (could also be &lt;CODE&gt;NULL&lt;/CODE&gt; not an empty string as below):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "line1\=(?&amp;lt;name1&amp;gt;[\w+]+)" 
| rex "line2\=(?&amp;lt;name2&amp;gt;[\w+]+)"
| fillnull name1 value=""
| fillnull name2 value=""
| eval fullname=name1.".".name2
| xyseries fullname date_hour count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Additionally this will actually add a dot &lt;CODE&gt;.&lt;/CODE&gt; between &lt;CODE&gt;name1&lt;/CODE&gt; and &lt;CODE&gt;name2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;If that is not working... please provide the result without the last &lt;CODE&gt;xyseries&lt;/CODE&gt; ...&lt;/P&gt;

&lt;P&gt;Hope that helps,&lt;BR /&gt;
Björn&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 07:49:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419857#M120723</guid>
      <dc:creator>bjoernjensen</dc:creator>
      <dc:date>2018-12-05T07:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use regex on 2 fields and combine them into one field for an xyseries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419858#M120724</link>
      <description>&lt;P&gt;@krusovice&lt;/P&gt;

&lt;P&gt;As per you given event, &lt;CODE&gt;name1&lt;/CODE&gt; and &lt;CODE&gt;name2&lt;/CODE&gt; are in separate event. So you have to make it in single event by  aggregating. like using &lt;CODE&gt;stats&lt;/CODE&gt; &lt;CODE&gt;values&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| stats values(name1) as name1 values(name2) as name2 by date_hour&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;here if you have any unique id for both events then you have to use it in by clause.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| stats values(name1) as name1 values(name2) as name2 by &amp;lt;&amp;lt;UNIQUE_ID&amp;gt;&amp;gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;For reference see below search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="line1=aaa" 
| append 
    [| makeresults 
    | eval _raw="line2=yyy"] | eval ID=10 | eval date_hour=10
| rex "line1=(?&amp;lt;name1&amp;gt;[\w+]+)" 
| rex "line2=(?&amp;lt;name2&amp;gt;[\w+]+)"  
| stats values(name1) as name1 values(name2) as name2 count by ID date_hour
| eval fullname=name1.".".name2
| xyseries fullname date_hour count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 09:04:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419858#M120724</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-12-05T09:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use regex on 2 fields and combine them into one field for an xyseries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419859#M120725</link>
      <description>&lt;P&gt;Is there a reason for using xyseries with date_hour instead of timechart span=1h?&lt;BR /&gt;
The date_foo fields are often trouble. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:21:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419859#M120725</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2020-09-29T22:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use regex on 2 fields and combine them into one field for an xyseries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419860#M120726</link>
      <description>&lt;P&gt;Thank you, you have given some clue how to fix my SPL. Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 03:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-regex-on-2-fields-and-combine-them-into-one-field/m-p/419860#M120726</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-12-14T03:53:32Z</dc:date>
    </item>
  </channel>
</rss>

