<?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: Host regex from file input in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629621#M218731</link>
    <description>&lt;P&gt;Ok I think i found out what the issue is.&lt;BR /&gt;&lt;BR /&gt;After changing the host_regex to just "(................)" to see what information is getting fed into splunk for that data, it showed only "source::SCC_SCAP" which means it's getting the data from my stanza configuration of&amp;nbsp;&lt;BR /&gt;Source=SCC_SCAP&lt;/P&gt;&lt;P&gt;When I removed that line, i started getting "source::&amp;lt;full_file_path&amp;gt;"&lt;BR /&gt;&lt;BR /&gt;So the issue was less about the regex not working, and more it was failing everytime and just defaulting back to the actual hot.&lt;BR /&gt;&lt;BR /&gt;But now i'm not sure how to fix the next problem.&amp;nbsp; I don't want a million *.txt files inside the "Sources" sections of the databases.&amp;nbsp; I want all of these text logs in a singular Source.&amp;nbsp; But i guess if no one knows how to keep those unified without declaring the source in the inputs.conf, I think i have to choose between regex_host and Source=&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 04 Feb 2023 22:21:54 GMT</pubDate>
    <dc:creator>icewolf69</dc:creator>
    <dc:date>2023-02-04T22:21:54Z</dc:date>
    <item>
      <title>How to host regex from file input?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629614#M218726</link>
      <description>&lt;P&gt;Hey All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm really struggling here.&amp;nbsp; I'm trying to get a universal forwarder to pull in txt logs, and edit the "host" field based on the filename/file path.&lt;/P&gt;
&lt;P&gt;Example file path:&lt;/P&gt;
&lt;P&gt;C:\SCAP_SCANS\Sessions\2023-02-04_1200\SERVER-test_SCC-5.7_2023-02-04_111238_Non-Compliance_MS_Windows_10_STIG-2.7.1.txt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inputs.conf stanza:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;[monitor://C:\SCAP_SCANS\Sessions]&lt;BR /&gt;disabled = false&lt;BR /&gt;ignoreOlderThan = 90d&lt;BR /&gt;host_regex = [^\\\]+(?=_SCC)&lt;BR /&gt;SHOULD_LINEMERGE = true&lt;BR /&gt;MAX_EVENTS = 500000&lt;BR /&gt;index = main&lt;BR /&gt;source = SCC_SCAP_TXT&lt;BR /&gt;sourcetype = SCC_SCAP_TXT&lt;BR /&gt;whitelist = (Non-Compliance).*\.(txt)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tried a few different regex's.&amp;nbsp; Checked btool to make sure there aren't any configs overwriting settings.&amp;nbsp; Tried with and without transforms and props files.&amp;nbsp; Verified regex works using the path and a makeresults query.&lt;BR /&gt;&lt;BR /&gt;Anyone have any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 00:13:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629614#M218726</guid>
      <dc:creator>icewolf69</dc:creator>
      <dc:date>2023-02-06T00:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Host regex from file input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629616#M218728</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;host_regex&lt;/FONT&gt; setting requires a capture group.&amp;nbsp; The example setting does not have one.&lt;/P&gt;&lt;P&gt;Please specify what&amp;nbsp; part of the file path is the server name and we should be able to produce a regex for it.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 18:10:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629616#M218728</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-02-04T18:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Host regex from file input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629617#M218729</link>
      <description>&lt;P&gt;It requires a capture group? Do you have to set a specific variable for that?&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\SCAP_SCANS\Sessions\2023-02-04_1200\&lt;U&gt;&lt;STRONG&gt;SERVER-test&lt;/STRONG&gt;&lt;/U&gt;_SCC-5.7_2023-02-04_111238_Non-Compliance_MS_Windows_10_STIG-2.7.1.txt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Bold and underlined is the server name.&lt;BR /&gt;&lt;BR /&gt;The following regex works fine on a makeresults:&lt;BR /&gt;(?&amp;lt;host&amp;gt;([^\\\\]+(?=_SCC)))&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 18:13:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629617#M218729</guid>
      <dc:creator>icewolf69</dc:creator>
      <dc:date>2023-02-04T18:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Host regex from file input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629618#M218730</link>
      <description>&lt;P&gt;No need to set a variable (perhaps not even allowed).&amp;nbsp; The first capture group becomes the host name.&lt;/P&gt;&lt;P&gt;This regex is more efficient, according to regex101.com&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\\([^\\\\]+)_SCC&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 04 Feb 2023 19:06:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629618#M218730</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-02-04T19:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Host regex from file input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629621#M218731</link>
      <description>&lt;P&gt;Ok I think i found out what the issue is.&lt;BR /&gt;&lt;BR /&gt;After changing the host_regex to just "(................)" to see what information is getting fed into splunk for that data, it showed only "source::SCC_SCAP" which means it's getting the data from my stanza configuration of&amp;nbsp;&lt;BR /&gt;Source=SCC_SCAP&lt;/P&gt;&lt;P&gt;When I removed that line, i started getting "source::&amp;lt;full_file_path&amp;gt;"&lt;BR /&gt;&lt;BR /&gt;So the issue was less about the regex not working, and more it was failing everytime and just defaulting back to the actual hot.&lt;BR /&gt;&lt;BR /&gt;But now i'm not sure how to fix the next problem.&amp;nbsp; I don't want a million *.txt files inside the "Sources" sections of the databases.&amp;nbsp; I want all of these text logs in a singular Source.&amp;nbsp; But i guess if no one knows how to keep those unified without declaring the source in the inputs.conf, I think i have to choose between regex_host and Source=&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 22:21:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-host-regex-from-file-input/m-p/629621#M218731</guid>
      <dc:creator>icewolf69</dc:creator>
      <dc:date>2023-02-04T22:21:54Z</dc:date>
    </item>
  </channel>
</rss>

