<?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: use extracted field as input parameter to transaction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89890#M23046</link>
    <description>&lt;P&gt;You most definitely can. As lisa says in her answer, you should NEVER create index-time field extractions unless you're completely sure of what you're doing and why. To the commands in the search pipeline, there is no difference in search-time and index-time extracted fields - it's just fields by the time they arrive to the search pipeline.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jan 2013 15:48:13 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2013-01-17T15:48:13Z</dc:date>
    <item>
      <title>use extracted field as input parameter to transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89886#M23042</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I'm relatively new to splunk and have been trying to correlate a series of events that occur in our logs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-01-14 11:12:20,512 [71] 54110 INFO  WebService RequestTypeA .......
2013-01-14 11:12:23,512 [71] 54110 INFO  WebService UserLogin: Tester .......
2013-01-14 11:12:25,512 [71] 54110 INFO  WebService Response .......
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The log is receiving thousands of entries per minute, so the way I've been handling this manually is grepping through our log files for:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[71] 54110
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Because not all of the information is ever present within a single log entry, I'd like to chain them together using the transaction command by using a field that that matches based on the following regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\[\d+\]\s+\[\d+\]\
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which seems to work based on what I'm seeing at: &lt;A href="http://regexpal.com/"&gt;http://regexpal.com/&lt;/A&gt;  .  Is this a scenario where I would need to &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/Configureindex-timefieldextraction"&gt;create a custom field at index time&lt;/A&gt;?&lt;/P&gt;

&lt;P&gt;The search I'd like to run would look for a particular type of request, look up its corresponding unique identifier ([71] 54110) and group them as a transaction.  Then take that result set and look up all fields containing "UserLogin) - search might look something lie:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" "RequestTypeA" | transaction [CUSTOMKEY] | UserLogin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To do this - I've modified -&lt;/P&gt;

&lt;P&gt;tranforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[pididThreadid]
REGEX = \[\d+\]\s+\[\d+\]
FORMAT = pid_thread_key::$1$2
WRITE_META = true
REPEAT_MATCH = false
CLEAN_KEYS = 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[log4j]
TRANSFORMS-pididThreadid = pididThreadid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fields.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[pid_thread_key]
INDEXED=true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Am I on the right track here?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2013 19:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89886#M23042</guid>
      <dc:creator>jasoneclark</dc:creator>
      <dc:date>2013-01-16T19:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: use extracted field as input parameter to transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89887#M23043</link>
      <description>&lt;P&gt;You can do this from the search line using the "rex" command as well. It might be easier to create two different fields because you might want to have a transaction for each pid and threadid. &lt;/P&gt;

&lt;P&gt;Here is an example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" "RequestTypeA" | rex field=_raw ",\d+\s+\[(?&amp;lt;pid&amp;gt;\d+)\]\s+(?&amp;lt;threadid&amp;gt;\d+)\s+"  | transaction threadid maxspan=15m 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Jan 2013 19:50:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89887#M23043</guid>
      <dc:creator>tgow</dc:creator>
      <dc:date>2013-01-16T19:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: use extracted field as input parameter to transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89888#M23044</link>
      <description>&lt;P&gt;Do &lt;STRONG&gt;not&lt;/STRONG&gt; make a custom field at index time. You will find that it is hard to manage and costly over the long run. &lt;/P&gt;

&lt;P&gt;Use the &lt;CODE&gt;rex&lt;/CODE&gt; command as tgow suggests, or use a search time field extraction. These choices will perform equally well and will not cause the heartache of index time fields.&lt;/P&gt;

&lt;P&gt;Next question: why do you need the transaction command?&lt;/P&gt;

&lt;P&gt;Why not do this:&lt;BR /&gt;
 1. Create a field extraction for the unique identifier. Call it &lt;CODE&gt;uid&lt;/CODE&gt; or something.&lt;BR /&gt;&lt;BR /&gt;
 2. Search like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" "RequestTypeA" uid="[71] 54110"  UserLogin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Of course, I don't know what you want to see in your final results.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 02:07:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89888#M23044</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-01-17T02:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: use extracted field as input parameter to transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89889#M23045</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;What I'm trying to do is extract an array of values that match [\d+]\s+[\d+]\ for my search criteria.  Then for every value in that array link then requests back together using the transaction command.&lt;/P&gt;

&lt;P&gt;I thought I read somewhere that you couldn't use a field extracted at search time to do this, and that's what sent me down the route I was on.&lt;/P&gt;

&lt;P&gt;Using the request you outline, I can't seem to get the transaction piece to work.&lt;/P&gt;

&lt;P&gt;Can you use fields extracted at search time with the transaction command?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 15:38:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89889#M23045</guid>
      <dc:creator>jasoneclark</dc:creator>
      <dc:date>2013-01-17T15:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: use extracted field as input parameter to transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89890#M23046</link>
      <description>&lt;P&gt;You most definitely can. As lisa says in her answer, you should NEVER create index-time field extractions unless you're completely sure of what you're doing and why. To the commands in the search pipeline, there is no difference in search-time and index-time extracted fields - it's just fields by the time they arrive to the search pipeline.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 15:48:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89890#M23046</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-01-17T15:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: use extracted field as input parameter to transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89891#M23047</link>
      <description>&lt;P&gt;Thanks! Works great.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 19:01:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-extracted-field-as-input-parameter-to-transaction/m-p/89891#M23047</guid>
      <dc:creator>jasoneclark</dc:creator>
      <dc:date>2013-01-17T19:01:29Z</dc:date>
    </item>
  </channel>
</rss>

