<?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 collect command/sourcetypes and \ character in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/collect-command-sourcetypes-and-character/m-p/543146#M153859</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Came across an interesting behaviour with collect today depending on whether you specify a sourcetype or not. If you have a field containing a \ character it will escape the \ when using a sourcetype, but not with stash.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;These two searches&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval field="App\X"
| collect index=main sourcetype="something_other_than_stash"&lt;/LI-CODE&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;| makeresults
| eval field="App\X"
| collect index=main&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;will generate two different field values in index for 'field'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When using the first with a sourcetype, the resultant field has two \\ characters in the field value in the index.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Both examples show the raw event as App\\X, but fieldsummary shows the one including sourcetype to be App\\\\X&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anyone know why this is?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Mar 2021 06:45:22 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2021-03-10T06:45:22Z</dc:date>
    <item>
      <title>collect command/sourcetypes and \ character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/collect-command-sourcetypes-and-character/m-p/543146#M153859</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Came across an interesting behaviour with collect today depending on whether you specify a sourcetype or not. If you have a field containing a \ character it will escape the \ when using a sourcetype, but not with stash.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;These two searches&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval field="App\X"
| collect index=main sourcetype="something_other_than_stash"&lt;/LI-CODE&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;| makeresults
| eval field="App\X"
| collect index=main&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;will generate two different field values in index for 'field'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When using the first with a sourcetype, the resultant field has two \\ characters in the field value in the index.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Both examples show the raw event as App\\X, but fieldsummary shows the one including sourcetype to be App\\\\X&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anyone know why this is?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 06:45:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/collect-command-sourcetypes-and-character/m-p/543146#M153859</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-03-10T06:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: collect command/sourcetypes and \ character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/collect-command-sourcetypes-and-character/m-p/543150#M153861</link>
      <description>&lt;P&gt;OK, so the answer is related to KV_MODE.&lt;/P&gt;&lt;P&gt;With stash, default KV_MODE is none, hence no escaping of the extracted fields is done. With a specified sourcetype the default will be KV_MODE=auto, so the data will be escaped when extracted.&lt;/P&gt;&lt;P&gt;Thanks to firebus on the apac slack channel&lt;/P&gt;&lt;P&gt;Also using&amp;nbsp;&lt;SPAN&gt;KV_MODE=auto_escaped works and that is specifically documented to honour escaped sequences within quoted strings&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 07:15:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/collect-command-sourcetypes-and-character/m-p/543150#M153861</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-03-10T07:15:03Z</dc:date>
    </item>
  </channel>
</rss>

