<?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: Map fields to sourcetype in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/661212#M111771</link>
    <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;I tried it and it looks like there are lots of duplicates and for example SysMon fields were as same as to XmlWinEvtLogs and there was no difference between fields within Application and Security for example.&lt;/P&gt;&lt;P&gt;Would you be able to have a look into the SPL and see if it can be optimized, please?&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;</description>
    <pubDate>Wed, 18 Oct 2023 14:49:15 GMT</pubDate>
    <dc:creator>DanAlexander</dc:creator>
    <dc:date>2023-10-18T14:49:15Z</dc:date>
    <item>
      <title>Map fields to sourcetype</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/660983#M111743</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I need help building a SPL that would return all available fields mapped to their sourcetypes/source&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking across all Indexers crawling through all indexes index=*&lt;/P&gt;
&lt;P&gt;I currently use to strip off all the fields and their extracted fields but I have no idea where they are coming from, what is their sourcetype and source:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=*

fieldsummary

| search values!="[]"

| rex field=values max_match=0 "\{\"value\":\"(?&amp;lt;extracted_values&amp;gt;[^\"]+)\""

| fields field extracted_values&lt;/LI-CODE&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 14:06:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/660983#M111743</guid>
      <dc:creator>DanAlexander</dc:creator>
      <dc:date>2023-10-18T14:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Map fields to sourcetype</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/661153#M111762</link>
      <description>&lt;P&gt;You could start with something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*
| fields - _time _raw
| foreach *
    [| eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if("&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=="index",index,sourcetype)]
| table *
| fillnull value="N/A"
| foreach *
    [eval sourcetype=if("&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"!="sourcetype",if('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'!="N/A",mvappend(sourcetype,"&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"),sourcetype),sourcetype)]
| dedup sourcetype
| table sourcetype&lt;/LI-CODE&gt;&lt;P&gt;It may fail due to the amount of data being brought back, so you might want to break it up by index. Also, it works by looking at the fields returned in the events, so if some fields are not used in the time period covered, they will not show up, so you might want to run it a different times of the day, rather than for longer periods.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 08:22:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/661153#M111762</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-10-18T08:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Map fields to sourcetype</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/661179#M111764</link>
      <description>&lt;P&gt;Thanks for the reply &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would it be possible to help me out creating something similar which can include both source and sourcetype, please?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 11:36:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/661179#M111764</guid>
      <dc:creator>DanAlexander</dc:creator>
      <dc:date>2023-10-18T11:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Map fields to sourcetype</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/661183#M111766</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*
| fields - _time _raw
| foreach *
    [| eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if("&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=="index",index,if("&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=="source",source,sourcetype))]
| table *
| fillnull value="N/A"
| foreach *
    [eval sourcetype=if("&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"!="sourcetype" AND "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"!="source" AND "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"!="index",if('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'!="N/A",mvappend(sourcetype,"&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"),sourcetype),sourcetype)]
| dedup sourcetype 
| table index source sourcetype&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 18 Oct 2023 12:09:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/661183#M111766</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-10-18T12:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Map fields to sourcetype</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/661212#M111771</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;I tried it and it looks like there are lots of duplicates and for example SysMon fields were as same as to XmlWinEvtLogs and there was no difference between fields within Application and Security for example.&lt;/P&gt;&lt;P&gt;Would you be able to have a look into the SPL and see if it can be optimized, please?&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 14:49:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Map-fields-to-sourcetype/m-p/661212#M111771</guid>
      <dc:creator>DanAlexander</dc:creator>
      <dc:date>2023-10-18T14:49:15Z</dc:date>
    </item>
  </channel>
</rss>

