<?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: Trying to take a value from one search and place it in another search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-take-a-value-from-one-search-and-place-it-in-another/m-p/532133#M150320</link>
    <description>&lt;P&gt;If both processes have the&amp;nbsp;&lt;SPAN&gt;ContextProcessId_decimal field then the stats values command will work and you won't need the where clause.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 06 Dec 2020 23:00:19 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2020-12-06T23:00:19Z</dc:date>
    <item>
      <title>Trying to take a value from one search and place it in another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-take-a-value-from-one-search-and-place-it-in-another/m-p/531928#M150263</link>
      <description>&lt;P&gt;I have a search that runs with no issues-&lt;BR /&gt;ComputerName=CompName* (event_simpleName=*written* OR event_simpleName=DirectoryCreate OR event_simpleName=*CreateFile)&lt;BR /&gt;*.xls* OR *.csv&lt;BR /&gt;| rename FileName as WrittenFileName, FilePath as SourceFilePath, TargetFileName as DestinationFileName&lt;BR /&gt;| table _time, ComputerName, WrittenFileName, SourceFilePath, DestinationFileName, sourcetype, ContextProcessId_decimal,TargetProcessId_decimal&lt;BR /&gt;&lt;BR /&gt;What I want to do is take the value from ContextProcessId_decimal and use it in a second search as the value for the field TargetProcessId_decimal.&lt;BR /&gt;event_simpleName=ProcessRollup2 OR event_simpleName=SyntheticProcessRollup2 TargetProcessId_decimal=ContextProcessid_decimal&lt;BR /&gt;&lt;BR /&gt;I've tried doing a search within the first search like the following, but it errors out. I've spent a good hour or two and have been unable to figure this out. -_-&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;ComputerName=CompName* (event_simpleName=*written* OR event_simpleName=DirectoryCreate OR event_simpleName=*CreateFile)&lt;BR /&gt;*.xls* OR *.csv&lt;BR /&gt;| rename FileName as WrittenFileName, FilePath as SourceFilePath, TargetFileName as DestinationFileName&lt;BR /&gt;[|search event_simpleName=ProcessRollup2 OR event_simpleName=SyntheticProcessRollup2 TargetProcessId_decimal=ContextProcessid_decimal]&lt;BR /&gt;| table _time, ComputerName, WrittenFileName, SourceFilePath, DestinationFileName, sourcetype, ContextProcessId_decimal,TargetProcessId_decimal&lt;BR /&gt;&lt;BR /&gt;If I leave the renames in it gives an error with that, if I take the rename out it finds no results. Any help would be greatly appreciated!!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 22:04:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-take-a-value-from-one-search-and-place-it-in-another/m-p/531928#M150263</guid>
      <dc:creator>aking76</dc:creator>
      <dc:date>2020-12-03T22:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to take a value from one search and place it in another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-take-a-value-from-one-search-and-place-it-in-another/m-p/531930#M150265</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/167789"&gt;@aking76&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Subsearches run before the outer search, so there is no way to pass data from the outer search to the subsearch.&lt;/P&gt;&lt;P&gt;The way to do this would be to combine the searches, so you search for both data sets in the initial search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(ComputerName=CompName* (event_simpleName=*written* OR event_simpleName=DirectoryCreate OR event_simpleName=*CreateFile)
*.xls* OR *.csv) OR 
(event_simpleName=ProcessRollup2 OR event_simpleName=SyntheticProcessRollup2) &lt;/LI-CODE&gt;&lt;P&gt;and then with both data types in the stream do your processing&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename FileName as WrittenFileName, FilePath as SourceFilePath, TargetFileName as DestinationFileName
| table _time, ComputerName, WrittenFileName, SourceFilePath, DestinationFileName, sourcetype, ContextProcessId_decimal, TargetProcessId_decimal
| stats values(*) as * by ContextProcessId_decimal
| where ContextProcessId_decimal=TargetProcessId_decimal&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;This&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Renames your fields and restricts the wanted fields&lt;/LI&gt;&lt;LI&gt;The aggregates all the values of data lines by the&amp;nbsp;&lt;SPAN&gt;ContextProcessid_decimal field&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;and then performs the test you need&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;However, without knowing your data, it's not clear if that will work - is the process id field the common field between the two data sets?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anyway, hopefully this gives you something to work with&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2020 22:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-take-a-value-from-one-search-and-place-it-in-another/m-p/531930#M150265</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-12-03T22:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to take a value from one search and place it in another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-take-a-value-from-one-search-and-place-it-in-another/m-p/532069#M150308</link>
      <description>&lt;P&gt;Thanks. I'm just waiting to get verification that the ContextProcessId_decimal does correlate to the TargetProcessID as I was originally told.&lt;BR /&gt;In the meantime, what if both searches have the same value. For instance, say they both have the ContextProcessId_decimal&amp;nbsp; field. Can I rename the first and then compare and pull in the information similar to above?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 19:38:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-take-a-value-from-one-search-and-place-it-in-another/m-p/532069#M150308</guid>
      <dc:creator>aking76</dc:creator>
      <dc:date>2020-12-04T19:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to take a value from one search and place it in another search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-take-a-value-from-one-search-and-place-it-in-another/m-p/532133#M150320</link>
      <description>&lt;P&gt;If both processes have the&amp;nbsp;&lt;SPAN&gt;ContextProcessId_decimal field then the stats values command will work and you won't need the where clause.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Dec 2020 23:00:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-take-a-value-from-one-search-and-place-it-in-another/m-p/532133#M150320</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-12-06T23:00:19Z</dc:date>
    </item>
  </channel>
</rss>

