<?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 edit my rex search to extract a Transaction ID and display this as _time, trans, and status? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338207#M100327</link>
    <description>&lt;P&gt;Hi Giuseppe!&lt;/P&gt;

&lt;P&gt;Thank you, that is exactly what I was looking for!  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Apr 2017 17:02:23 GMT</pubDate>
    <dc:creator>leomedina</dc:creator>
    <dc:date>2017-04-19T17:02:23Z</dc:date>
    <item>
      <title>How to edit my rex search to extract a Transaction ID and display this as _time, trans, and status?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338199#M100319</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I am attempting to extract a Transaction ID and display this as _time, trans, status&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=datapower environment=Prod  "HTTP response code*" 'http://ResellerCheck/'  
| lookup oauth_http_response_codes.csv response_code OUTPUT status, description 
| search trans 
| rex field=_raw "trans(?P&amp;lt;AppName&amp;gt;[^\s]+): trans" 
| stats count response_code by _time, trans, status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have been working on this for the past three hours and went through the main page for search and rex but don't get any "Statistical" extract.  I, however, see the Events.  What am I doing wrong here?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 22:49:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338199#M100319</guid>
      <dc:creator>leomedina</dc:creator>
      <dc:date>2017-04-18T22:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex search to extract a Transaction ID and display this as _time, trans, and status?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338200#M100320</link>
      <description>&lt;P&gt;I'm not sure rex is what you think it is.. Rex will do a search time field extraction which allows you to use that field.. In your case, your rex command is telling you to extract a field called &lt;CODE&gt;AppName&lt;/CODE&gt; that is at the beginning of a line with a space prefixed with trans.. &lt;/P&gt;

&lt;P&gt;If your intent is to extract a field from the raw data, can you provide some sample data that you want to extract?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 23:05:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338200#M100320</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2017-04-18T23:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex search to extract a Transaction ID and display this as _time, trans, and status?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338201#M100321</link>
      <description>&lt;P&gt;Also, why are you using single quotes in your search?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 04:08:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338201#M100321</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-04-19T04:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex search to extract a Transaction ID and display this as _time, trans, and status?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338202#M100322</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/31880"&gt;@leomedina&lt;/a&gt;... if trans is a field in your events and not lookup you should add trans to base search rather than &lt;CODE&gt;| search trans&lt;/CODE&gt;. If AppName is the field you need to extract then perform stats by AppName not trans. Do the events being correlated have the same _time? If they are different you would need min(_time) EarliestTime and max(_time) as LatestTime statistical functions for aggregating _time.&lt;/P&gt;

&lt;P&gt;Please add some sample mock events for the community to help you with the same.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:42:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338202#M100322</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T13:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex search to extract a Transaction ID and display this as _time, trans, and status?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338203#M100323</link>
      <description>&lt;P&gt;Hi leomedina,&lt;BR /&gt;
could you share some log example?&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 06:55:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338203#M100323</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-04-19T06:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex search to extract a Transaction ID and display this as _time, trans, and status?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338204#M100324</link>
      <description>&lt;P&gt;Hi Niketnilay,&lt;/P&gt;

&lt;P&gt;I did some modifications to it to reflect your suggestion, but I am still not getting what I want.  Trans is part of a field named ApplicationName.  However, there is a lot more data than what I need within this field; ie. trans(12345678) gtid(87654321).  Would it be possible to trim down the data to only obtain what I need?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=datapower environment=Prod "HTTP response code*" "http://ResellerCheck/" "trans"
| lookup oauth_http_response_codes.csv response_code OUTPUT status, description  
| sort  -_time | eval  Time=_time | convert  timeformat="%b-%d-%y %I:%M:%S %p" ctime(Time)  
| search trans
| rex field=_raw "trans(?P&amp;lt;trans&amp;gt;[^\s]+): trans" 
| table  Time, trans, response_code, description
| rename response_code as "Response Code", description as "Description", trans as "TransactionID"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ultimately what I am looking for is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Time                         TransactionID          Response Code                Description
Apr-18-17 11:51:27 PM        123456789                403                             Forbidden
Apr-18-17 11:51:27 PM        123456788                200                             OK
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Greatly appreciate the help and assistance.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 07:13:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338204#M100324</guid>
      <dc:creator>leomedina</dc:creator>
      <dc:date>2017-04-19T07:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex search to extract a Transaction ID and display this as _time, trans, and status?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338205#M100325</link>
      <description>&lt;P&gt;Hi Guiseppe,&lt;/P&gt;

&lt;P&gt;Please see below example log.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Apr 19 06:51:27 myhost04 [WebApp][0x80e0015b][mpgw][info] mpgw(ResellerCheck): trans(1162505423) gtid(3083100428): HTTP response code 200 for "http://ResellerCheck/"
Apr 18 21:31:20 myhost03 [WebApp][0x80e0015b][mpgw][info] mpgw(ResellerCheck): trans(278913012) gtid(2705343391): HTTP response code 200 for "http://ResellerCheck/"
Apr 18 13:20:50 myhost03 [WebApp][0x80e0015b][mpgw][info] mpgw(ResellerCheck): trans(355305813)[127.0.0.2] gtid(2667779775): HTTP response code 200 for "http://ResellerCheck/"
Apr 18 13:18:35 myhost03 [WebApp][0x80e0015b][mpgw][info] mpgw(ResellerCheck): trans(355302277) gtid(2667591343): HTTP response code 403 for "http://ResellerCheck/"
Apr 18 08:34:06 myhost03 [WebApp][0x80e0015b][mpgw][info] mpgw(ResellerCheck): trans(354804325)[127.0.0.2] gtid(2643772783): HTTP response code 200 for "http://ResellerCheck/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 07:57:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338205#M100325</guid>
      <dc:creator>leomedina</dc:creator>
      <dc:date>2017-04-19T07:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex search to extract a Transaction ID and display this as _time, trans, and status?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338206#M100326</link>
      <description>&lt;P&gt;Hi leomedina,&lt;BR /&gt;
you can see below the regex to extract transactionId that I imagine is the number after "trans" &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;trans\((?&amp;lt;transactionId&amp;gt;[^\)]*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can test it at in &lt;A href="https://regex101.com/r/UMpQlI/1"&gt;https://regex101.com/r/UMpQlI/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In addition you could move the search for the "trans" word in the beginning (it's a best practice to filter as more as possible in the first search), something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=datapower environment=Prod  "HTTP response code*" 'http://ResellerCheck/'  trans 
 | lookup oauth_http_response_codes.csv response_code OUTPUT status, description 
 | rex "trans\((?&amp;lt;transactionId&amp;gt;[^\)]*)" 
 | stats count response_code by _time, transactionId, status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 08:09:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338206#M100326</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-04-19T08:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex search to extract a Transaction ID and display this as _time, trans, and status?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338207#M100327</link>
      <description>&lt;P&gt;Hi Giuseppe!&lt;/P&gt;

&lt;P&gt;Thank you, that is exactly what I was looking for!  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 17:02:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-search-to-extract-a-Transaction-ID-and/m-p/338207#M100327</guid>
      <dc:creator>leomedina</dc:creator>
      <dc:date>2017-04-19T17:02:23Z</dc:date>
    </item>
  </channel>
</rss>

