<?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 Events with &amp;quot;\&amp;quot; character in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413346#M119167</link>
    <description>&lt;P&gt;I was making some SQL dashboard and i can't use some variables cause one of them is the kerberos USER that comes like:&lt;BR /&gt;
"MyDomain\User1"&lt;BR /&gt;
MyDomain\User2"&lt;BR /&gt;
MyDomain\User3"&lt;BR /&gt;
MyDomain\User4"&lt;/P&gt;

&lt;P&gt;My search is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="mssql" sourcetype="mssql:audit"
| eval user=lower(server_principal_name)
| search user="$m_user$"
| table _time name user statement
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where &lt;STRONG&gt;m_user&lt;/STRONG&gt; is a dropdown input that populate this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="mssql" sourcetype="mssql:audit" statement!="" statement!="--*" server_principal_name!="*SYSTEM"
| eval user=lower(server_principal_name)
| dedup user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(I use a lower function cause server_principal_name can be "MyDomain\USer1" or ""MyDomain\user1")&lt;/P&gt;

&lt;P&gt;The thing is when m_user get's the value (for example) "MyDomain\User1" the search didn't find result, but if i look for "MyDomain\user1" the search finds the events. I was trying to do a eval thing like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="mssql" sourcetype="mssql:audit"
    | eval user=lower(server_principal_name)
    | search user="$m_user$"
    | eval user=replace(user,".+\\.+","\\\\")
    | table _time name user statement
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;without success. Some idea?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 19:39:28 GMT</pubDate>
    <dc:creator>jnahuelperez35</dc:creator>
    <dc:date>2020-09-29T19:39:28Z</dc:date>
    <item>
      <title>Search Events with "\" character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413346#M119167</link>
      <description>&lt;P&gt;I was making some SQL dashboard and i can't use some variables cause one of them is the kerberos USER that comes like:&lt;BR /&gt;
"MyDomain\User1"&lt;BR /&gt;
MyDomain\User2"&lt;BR /&gt;
MyDomain\User3"&lt;BR /&gt;
MyDomain\User4"&lt;/P&gt;

&lt;P&gt;My search is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="mssql" sourcetype="mssql:audit"
| eval user=lower(server_principal_name)
| search user="$m_user$"
| table _time name user statement
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where &lt;STRONG&gt;m_user&lt;/STRONG&gt; is a dropdown input that populate this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="mssql" sourcetype="mssql:audit" statement!="" statement!="--*" server_principal_name!="*SYSTEM"
| eval user=lower(server_principal_name)
| dedup user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(I use a lower function cause server_principal_name can be "MyDomain\USer1" or ""MyDomain\user1")&lt;/P&gt;

&lt;P&gt;The thing is when m_user get's the value (for example) "MyDomain\User1" the search didn't find result, but if i look for "MyDomain\user1" the search finds the events. I was trying to do a eval thing like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="mssql" sourcetype="mssql:audit"
    | eval user=lower(server_principal_name)
    | search user="$m_user$"
    | eval user=replace(user,".+\\.+","\\\\")
    | table _time name user statement
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;without success. Some idea?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413346#M119167</guid>
      <dc:creator>jnahuelperez35</dc:creator>
      <dc:date>2020-09-29T19:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Search Events with "\" character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413347#M119168</link>
      <description>&lt;P&gt;In your original search, try changing:&lt;BR /&gt;
&lt;CODE&gt;| search user="$m_user$"&lt;/CODE&gt;&lt;BR /&gt;
to:&lt;BR /&gt;
&lt;CODE&gt;| where user="$m_user$"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The where command interprets quoted strings as literals and should do a better job of comparing strings with an escape character.&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 15:11:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413347#M119168</guid>
      <dc:creator>wildcats12</dc:creator>
      <dc:date>2018-05-21T15:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Search Events with "\" character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413348#M119169</link>
      <description>&lt;P&gt;@jnahuelperez35, &lt;CODE&gt;search&lt;/CODE&gt; match is not case-sensitive. So there is no need for &lt;CODE&gt;| eval user=lower(server_principal_name)&lt;/CODE&gt; in Dropdown query or in your search. Also it is better to filter results upfront in the base search when you pull events from raw data, rather than filtering afterwards i.e.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="mssql" sourcetype="mssql:audit" server_principal_name=$m_user|s$
| table _time name user statement
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You need to use &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Token_filters"&gt;token filter&lt;/A&gt; to use the token as String. In this case &lt;CODE&gt;server_principal_name=$m_user|s$&lt;/CODE&gt;&lt;BR /&gt;
Following is a run anywhere example based on Sample Data and code provided.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Dropdown with backslash&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="m_user" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Select User&amp;lt;/label&amp;gt;
      &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;user&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;user&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;| makeresults
| fields - _time
| eval user="MyDomain\User1;MyDomain\User2;MyDomain\User3;MyDomain\User4"
| makemv user delim=";"
| mvexpand user
| dedup user&amp;lt;/query&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
|  fields - _time
| eval user="MyDomain\User1;MyDomain\User2;MyDomain\User3;MyDomain\User4"
| makemv user delim=";"
| mvexpand user
| search user=$m_user|s$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 May 2018 15:35:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413348#M119169</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-05-21T15:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Search Events with "\" character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413349#M119170</link>
      <description>&lt;P&gt;thanks for the answer&lt;BR /&gt;
using where i can search for "mydomain\user" but i can't use with "*" character that means "hey ,give me events of any user".&lt;BR /&gt;
Any idea?&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 15:36:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413349#M119170</guid>
      <dc:creator>jnahuelperez35</dc:creator>
      <dc:date>2018-05-21T15:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Search Events with "\" character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413350#M119171</link>
      <description>&lt;P&gt;Yes, you can still use a wildcard search within a where, but the syntax is different.  Try the like() function:&lt;BR /&gt;
&lt;CODE&gt;| where like(user,"%")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The "%" character is the equivalent of "*" within where, eval, etc when used inside like().&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 15:46:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Events-with-quot-quot-character/m-p/413350#M119171</guid>
      <dc:creator>wildcats12</dc:creator>
      <dc:date>2018-05-21T15:46:44Z</dc:date>
    </item>
  </channel>
</rss>

