<?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: custom source column in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530887#M149963</link>
    <description>&lt;P&gt;Splunk has a built-in field called "source" so you should avoid trying to create fields with that name.&amp;nbsp; Try this query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex &amp;lt;my search&amp;gt;
| rex ".*source=(?&amp;lt;Source&amp;gt;[^,]+).*col1=(?&amp;lt;Col1&amp;gt;[^,}]+).col2=(?&amp;lt;Col2&amp;gt;[^,}]+).col3=(?&amp;lt;Col3&amp;gt;[^,}]+)"
| kv
| table Source Col1 Col2 Col3
| sort – Source Col1 Col2&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 25 Nov 2020 20:31:57 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-11-25T20:31:57Z</dc:date>
    <item>
      <title>custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530883#M149961</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to create a table output of events in logilfe. Here is the query -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex &amp;lt;my search&amp;gt;
| rex ".*source=(?&amp;lt;source&amp;gt;[^,]+).*col1=(?&amp;lt;Col1&amp;gt;[^,}]+).col2=(?&amp;lt;Col2&amp;gt;[^,}]+).col3=(?&amp;lt;Col3&amp;gt;[^,}]+)"
| kv
| table source Col1 Col2 Col3
| sort – source Col1 Col2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my source column,&amp;nbsp; values can be like - Email, Scan, or Fax&lt;/P&gt;&lt;P&gt;But when I get the result then I get the value of source as the "source file" - "D:\App\tomcat\logs\applog.log" instead of values like "Email, Scan, or Fax"&lt;/P&gt;&lt;P&gt;How can I get the values of "source" fro the logfile event.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 20:18:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530883#M149961</guid>
      <dc:creator>runiyal</dc:creator>
      <dc:date>2020-11-25T20:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530887#M149963</link>
      <description>&lt;P&gt;Splunk has a built-in field called "source" so you should avoid trying to create fields with that name.&amp;nbsp; Try this query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex &amp;lt;my search&amp;gt;
| rex ".*source=(?&amp;lt;Source&amp;gt;[^,]+).*col1=(?&amp;lt;Col1&amp;gt;[^,}]+).col2=(?&amp;lt;Col2&amp;gt;[^,}]+).col3=(?&amp;lt;Col3&amp;gt;[^,}]+)"
| kv
| table Source Col1 Col2 Col3
| sort – Source Col1 Col2&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 25 Nov 2020 20:31:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530887#M149963</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-25T20:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530901#M149965</link>
      <description>&lt;P&gt;Hello Rich, Using "&lt;STRONG&gt;S&lt;/STRONG&gt;ource" is giving me null value. Field value is empty.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 21:17:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530901#M149965</guid>
      <dc:creator>runiyal</dc:creator>
      <dc:date>2020-11-25T21:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530907#M149968</link>
      <description>&lt;P&gt;Double-check your query to make sure you've used the same field name throughout.&lt;/P&gt;&lt;P&gt;Make sure your regular expression is correct (use regex101.com to test it).&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 22:27:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530907#M149968</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-25T22:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530925#M149974</link>
      <description>&lt;P&gt;Thanks for your inputs. Checked the code again but sees fine unless I am missing anything -&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex " source=(?&amp;lt;Source&amp;gt;[^,]+).center=(?&amp;lt;center&amp;gt;[^,]+).accountNum=(?&amp;lt;accountNum&amp;gt;[^,]+).policyNum=(?&amp;lt;policyNum&amp;gt;[^,]+).clmNumber=(?&amp;lt;clmNumber&amp;gt;[^,]+).name=(?&amp;lt;name&amp;gt;[^,]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;if I say &amp;lt;&lt;STRONG&gt;s&lt;/STRONG&gt;ource&amp;gt; then it provide the source file name but not the value in the logfile for "source".&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 00:26:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/530925#M149974</guid>
      <dc:creator>runiyal</dc:creator>
      <dc:date>2020-11-26T00:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531018#M150012</link>
      <description>&lt;P&gt;Please provide a sample event or two so we can verify the regex.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 14:38:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531018#M150012</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-26T14:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531215#M150067</link>
      <description>&lt;P&gt;Hello Rich, here are some of the events -&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2020-11-25 18:23:47,432 INFO  [com.mycomp.docrepo.upload.FileUploadWebScript] [http-apr-8080-exec-3] The Upload Service /docrepo/service/comp/upload succeeded in 0.123000 seconds, Request: {col1=ab, col2=11252020_B1_DOC0_Fax_a4.HEIC, source=Fax, col3=application/octet-pdf}
2020-11-25 18:23:47,358 INFO  [com.mycomp.docrepo.upload.FileUploadWebScript] [http-apr-8080-exec-2] The Upload Service /docrepo/service/comp/upload succeeded in 0.255000 seconds, Request: {col1=cc, col2=11252020_B2_DOC0_Scan_a5.HEIC, source=Scan, col3=application/octet-pdf}
2020-11-25 18:23:43,066 INFO  [com.mycomp.docrepo.upload.FileUploadWebScript] [http-apr-8080-exec-4] The Upload Service /docrepo/service/comp/upload succeeded in 0.543000 seconds, Request: {col1=xy, col2=11252020_B3_DOC0_Email_a3.HEIC, source=Email, col3=application/octet-stream}
2020-11-25 18:23:42,789 INFO  [com.mycompe.docrepo.upload.FileUploadWebScript] [http-apr-8080-exec-2] The Upload Service /docrepo/service/comp/upload succeeded in 0.262000 seconds, Request: {col1=pc, col2=11252020_B3_DOC0_Email_a2.HEIC, source=Email, col3=application/octet-stream}
2020-11-25 18:23:42,344 INFO  [com.mycomp.docrepo.upload.FileUploadWebScript] [http-apr-8080-exec-8] The Upload Service /docrepo/service/comp/upload succeeded in 0.254000 seconds, Request: {col1=ab, col2=11252020_B3_DOC0_Email_a1.HEIC, source=Email, col3=application/octet-stream}
2020-11-25 16:04:19,342 INFO  [com.mycomp.docrepo.upload.FileUploadWebScript] [http-apr-8080-exec-7] The Upload Service /docrepo/service/comp/upload succeeded in 0.569000 seconds, Request: {col1=xy, col2=11252020_B4_DOC0_Email_a2.MOV, source=Email, col3=application/octet-stream}&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 28 Nov 2020 02:27:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531215#M150067</guid>
      <dc:creator>runiyal</dc:creator>
      <dc:date>2020-11-28T02:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531244#M150068</link>
      <description>&lt;P&gt;Thanks for the sample events.&amp;nbsp; As it turns out, none of them come close to matching the regex in the &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; command.&lt;/P&gt;&lt;P&gt;The rex is looking for the "source" keyword followed, in order, by "enter", "accountNum", "policyNum", "clmNumber", and "name".&amp;nbsp;&lt;/P&gt;&lt;P&gt;While all of the sample events contain "source", none contain "center" or "name".&amp;nbsp; I stopped looked for the other keywords at that point.&lt;/P&gt;&lt;P&gt;If all all keywords are expected in all events or if they may be in a different order then separate &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; commands should be used for each keyword.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 21:34:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531244#M150068</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-28T21:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531246#M150069</link>
      <description>&lt;P&gt;Sorry Rich, here is the actual regex for the events mentioned above that I am using -&lt;/P&gt;&lt;P&gt;rex " source=(?&amp;lt;Source&amp;gt;[^,]+).col1=(?&amp;lt;Col1&amp;gt;[^,]+).col2=(?&amp;lt;Col2&amp;gt;[^,]+).col3=(?&amp;lt;Col3&amp;gt;[^,]+)"&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 22:14:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531246#M150069</guid>
      <dc:creator>runiyal</dc:creator>
      <dc:date>2020-11-28T22:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531249#M150071</link>
      <description>&lt;P&gt;That's better, but the fields in the events are not in the same order as in the regex.&amp;nbsp; I think you're better off using multiple rex commands.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "source=(?&amp;lt;Source&amp;gt;[^,]+)."
| rex "col1=(?&amp;lt;Col1&amp;gt;[^,]+),"
| rex "col2=(?&amp;lt;Col2&amp;gt;[^,]+),"
| rex "col3=(?&amp;lt;Col3&amp;gt;[^}]+)"&lt;/LI-CODE&gt;&lt;P&gt;If you really want a single rex then make sure the fields are extracted in the right order.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "col1=(?&amp;lt;Col1&amp;gt;[^,]+), col2=(?&amp;lt;Col2&amp;gt;[^,]+), source=(?&amp;lt;Source&amp;gt;[^,]+), col3=(?&amp;lt;Col3&amp;gt;[^}]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2020 01:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531249#M150071</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-29T01:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: custom source column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531393#M150102</link>
      <description>&lt;P&gt;Your suggestion of using multiple rex commands like below worked.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| rex "source=(?&amp;lt;Source&amp;gt;[^,]+)." | rex "col1=(?&amp;lt;Col1&amp;gt;[^,]+)," | rex "col2=(?&amp;lt;Col2&amp;gt;[^,]+)," | rex "col3=(?&amp;lt;Col3&amp;gt;[^}]+)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 19:40:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-source-column/m-p/531393#M150102</guid>
      <dc:creator>runiyal</dc:creator>
      <dc:date>2020-11-30T19:40:25Z</dc:date>
    </item>
  </channel>
</rss>

