<?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 Search with a Variable in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-with-a-Variable/m-p/549924#M156062</link>
    <description>&lt;P&gt;Hi Team How are u?&lt;/P&gt;&lt;P&gt;I have a little question&lt;/P&gt;&lt;P&gt;I have a index with same informations,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="epo" source="endpoint"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this search will return a column with "JustificationText",&amp;nbsp;Which contains a ticket number&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JuanAntunes_0-1619733392680.png" style="width: 150px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13994i892EBDA707E7541E/image-dimensions/150x279?v=v2" width="150" height="279" role="button" title="JuanAntunes_0-1619733392680.png" alt="JuanAntunes_0-1619733392680.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And with this number I need to search in another index to get some information&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Today i'm doing this way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="epo" source="endpoint"​
| rex field="JustificationText" "(?&amp;lt;number&amp;gt;REQ\d{7}|&amp;lt;number&amp;gt;INC\d{7}|&amp;lt;number&amp;gt;TRE\d{7}|&amp;lt;number&amp;gt;CHG\d{7})"
| eval TicketNumber = number
| dedup ViolationLocalTime IncindetId
| join type=left
     [search index=servicenow sourcetype="snow:service_task" dv_number = TicketNumber]
| table Status ViolationLocalTime IncidentId UserName Name JustificationText TotalContentSize RulesToDisplay contact_type dv_u_requested_by dv_location&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;All the data from the first serach is coming ok but when I do a second search with the variable "TicketNumber" nothing returns to me.&lt;BR /&gt;&lt;BR /&gt;If i for example, put a ticket in&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| join type=left
     [search index=servicenow sourcetype="snow:service_task" dv_number = "REQ0000197"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data are brought, but the same for all events&lt;BR /&gt;&lt;BR /&gt;My question is how can I do this second search using a variable?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Apr 2021 22:06:42 GMT</pubDate>
    <dc:creator>JuanAntunes</dc:creator>
    <dc:date>2021-04-29T22:06:42Z</dc:date>
    <item>
      <title>Search with a Variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-with-a-Variable/m-p/549924#M156062</link>
      <description>&lt;P&gt;Hi Team How are u?&lt;/P&gt;&lt;P&gt;I have a little question&lt;/P&gt;&lt;P&gt;I have a index with same informations,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="epo" source="endpoint"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this search will return a column with "JustificationText",&amp;nbsp;Which contains a ticket number&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JuanAntunes_0-1619733392680.png" style="width: 150px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13994i892EBDA707E7541E/image-dimensions/150x279?v=v2" width="150" height="279" role="button" title="JuanAntunes_0-1619733392680.png" alt="JuanAntunes_0-1619733392680.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And with this number I need to search in another index to get some information&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Today i'm doing this way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="epo" source="endpoint"​
| rex field="JustificationText" "(?&amp;lt;number&amp;gt;REQ\d{7}|&amp;lt;number&amp;gt;INC\d{7}|&amp;lt;number&amp;gt;TRE\d{7}|&amp;lt;number&amp;gt;CHG\d{7})"
| eval TicketNumber = number
| dedup ViolationLocalTime IncindetId
| join type=left
     [search index=servicenow sourcetype="snow:service_task" dv_number = TicketNumber]
| table Status ViolationLocalTime IncidentId UserName Name JustificationText TotalContentSize RulesToDisplay contact_type dv_u_requested_by dv_location&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;All the data from the first serach is coming ok but when I do a second search with the variable "TicketNumber" nothing returns to me.&lt;BR /&gt;&lt;BR /&gt;If i for example, put a ticket in&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| join type=left
     [search index=servicenow sourcetype="snow:service_task" dv_number = "REQ0000197"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data are brought, but the same for all events&lt;BR /&gt;&lt;BR /&gt;My question is how can I do this second search using a variable?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 22:06:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-with-a-Variable/m-p/549924#M156062</guid>
      <dc:creator>JuanAntunes</dc:creator>
      <dc:date>2021-04-29T22:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search with a Variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-with-a-Variable/m-p/549936#M156063</link>
      <description>&lt;P&gt;You could try something like this - join with a common field name&amp;nbsp; e.g. dv_number instead of TicketNumber&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="epo" source="endpoint"​
| rex field="JustificationText" "(?&amp;lt;number&amp;gt;REQ\d{7}|&amp;lt;number&amp;gt;INC\d{7}|&amp;lt;number&amp;gt;TRE\d{7}|&amp;lt;number&amp;gt;CHG\d{7})"
| eval dv_number = number
| dedup ViolationLocalTime IncindetId
| join type=left dv_number 
     [search index=servicenow sourcetype="snow:service_task" ]
| table Status ViolationLocalTime IncidentId UserName Name JustificationText TotalContentSize RulesToDisplay contact_type dv_u_requested_by dv_location&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 29 Apr 2021 22:48:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-with-a-Variable/m-p/549936#M156063</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-29T22:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Search with a Variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-with-a-Variable/m-p/549981#M156070</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; Thanks you for reply&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;But running the query the way you told me still doesn't return anything&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="epo" source="endpoint"​
| rex field="JustificationText" "(?&amp;lt;number&amp;gt;REQ\d{7}|&amp;lt;number&amp;gt;INC\d{7}|&amp;lt;number&amp;gt;TRE\d{7}|&amp;lt;number&amp;gt;CHG\d{7})"
| eval dv_number = number
| dedup ViolationLocalTime IncindetId
| join type=left dv_number 
     [search index=servicenow sourcetype="snow:service_task" ]
| table Status ViolationLocalTime IncidentId UserName Name JustificationText TotalContentSize RulesToDisplay contact_type dv_u_requested_by dv_location&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;in the events that are found the tickets, we should have the columns of the NOW table, but it is always blank&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JuanAntunes_1-1619777932449.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13999i79CCADF3800C71E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JuanAntunes_1-1619777932449.png" alt="JuanAntunes_1-1619777932449.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other suggestions? Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 10:19:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-with-a-Variable/m-p/549981#M156070</guid>
      <dc:creator>JuanAntunes</dc:creator>
      <dc:date>2021-04-30T10:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Search with a Variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-with-a-Variable/m-p/549984#M156072</link>
      <description>&lt;P&gt;I can't see any reason why it would not work. Can you try a different way of forcing the join to return the same ticket for all events?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="epo" source="endpoint"​
| rex field="JustificationText" "(?&amp;lt;number&amp;gt;REQ\d{7}|&amp;lt;number&amp;gt;INC\d{7}|&amp;lt;number&amp;gt;TRE\d{7}|&amp;lt;number&amp;gt;CHG\d{7})"
| eval dv_number = "REQ0000197"
| dedup ViolationLocalTime IncindetId
| join type=left dv_number 
     [search index=servicenow sourcetype="snow:service_task" ]
| table Status ViolationLocalTime IncidentId UserName Name JustificationText TotalContentSize RulesToDisplay contact_type dv_u_requested_by dv_location&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 30 Apr 2021 11:35:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-with-a-Variable/m-p/549984#M156072</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-30T11:35:32Z</dc:date>
    </item>
  </channel>
</rss>

