<?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: Extract Multiple Values From A Monitored File in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41178#M9551</link>
    <description>&lt;P&gt;Before you can do that you're going to have to teach splunk what a record looks like. Your data is spread over serveral lines, and by default splunk sees every line as a record. Can you post a larger example of the log, or identify a consistend start or end to an individual record ?&lt;/P&gt;</description>
    <pubDate>Fri, 22 Feb 2013 22:15:23 GMT</pubDate>
    <dc:creator>jonuwz</dc:creator>
    <dc:date>2013-02-22T22:15:23Z</dc:date>
    <item>
      <title>Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41176#M9549</link>
      <description>&lt;P&gt;Hey Everyone,&lt;/P&gt;

&lt;P&gt;I don't know if I'm doing this correctly.&lt;/P&gt;

&lt;P&gt;I have a text file that contains data I want to index. So with the universal forwarder I've setup a monitor statement like this:&lt;/P&gt;

&lt;P&gt;[monitor://C:\fileToMonitor.txt]&lt;/P&gt;

&lt;P&gt;The contents of the file look something like this:&lt;/P&gt;

&lt;P&gt;[Fri Feb 22 11:54:51 2013] Serial Number: &amp;lt;333-333-222/12000000&amp;gt;&lt;BR /&gt;
[Fri Feb 22 11:54:51 2013] Model Type: &lt;US777&gt;&lt;BR /&gt;
[Fri Feb 22 11:54:51 2013] O/S: &lt;NUMBERSANDLETTERS&gt;&lt;/NUMBERSANDLETTERS&gt;&lt;/US777&gt;&lt;/P&gt;

&lt;P&gt;I would like to pull the following data:&lt;/P&gt;

&lt;P&gt;Serial Number as Field serialNumber&lt;BR /&gt;
Model Type as Field modelType&lt;BR /&gt;
And O/S as Field operatingSystem&lt;/P&gt;

&lt;P&gt;I'm doing so with a combination of props.conf and transforms.conf&lt;/P&gt;

&lt;P&gt;PROPS.CONF&lt;BR /&gt;
[source::c:\fileToMonitor.txt]&lt;BR /&gt;
sourcetype = mystuff&lt;BR /&gt;
REPORT-myst = mystuff_extractions&lt;/P&gt;

&lt;P&gt;TRANSFORMS.CONF&lt;BR /&gt;
[mystuff_extractions]&lt;BR /&gt;
REGEX = my regex statement?????&lt;BR /&gt;
FORMAT = serialNumber::$1 modelNumber::$2 operatingSystem::$3 &lt;/P&gt;

&lt;P&gt;Luckily all of the information is found within the brackets &amp;lt; &amp;gt;. But I am unsure of how to build a regular a regular expression that will do this and pull all three values at the same time. I've tested a few times but have not been successfull.&lt;/P&gt;

&lt;P&gt;Aside from getting the regex right, I would like to perform all of this as efficiently as possible. I simple hacked to gether this stuff from different posts I've read, but if there is a better way to do this, please let me know.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2013 21:37:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41176#M9549</guid>
      <dc:creator>barne_dn</dc:creator>
      <dc:date>2013-02-22T21:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41177#M9550</link>
      <description>&lt;P&gt;The simplest in my mind is to use inline extractions, you can set these through Manager -&amp;gt; Fields -&amp;gt; Field Extractions. As for your expressions, something like this might work (one per extraction, whole line goes into the Inline field):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Serial Number: &amp;lt;(?&amp;lt;serialNumber&amp;gt;[^&amp;gt;]+)&amp;gt;

Model Type: &amp;lt;(?&amp;lt;modelType&amp;gt;[^&amp;gt;]+)&amp;gt;

O/S: &amp;lt;(?&amp;lt;operatingSystem&amp;gt;[^&amp;gt;]+)&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;All three work in the same way - they first look for the prefix of your field, for example "O/S: &amp;lt;", then for the field content, at least one character that's not a closing angle bracket, and then for the suffix "&amp;gt;".&lt;/P&gt;

&lt;P&gt;If you prefer editing the config files manually, add an EXTRACT-classname key for each to the appropriate props.conf stanza.&lt;/P&gt;

&lt;P&gt;Concerning efficiency, these expressions are extremely efficient because they look for a very specific static prefix - in other words, they fail fast. There are no huge trees of options to walk before the automaton notices that it's in the wrong forest.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2013 22:14:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41177#M9550</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-02-22T22:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41178#M9551</link>
      <description>&lt;P&gt;Before you can do that you're going to have to teach splunk what a record looks like. Your data is spread over serveral lines, and by default splunk sees every line as a record. Can you post a larger example of the log, or identify a consistend start or end to an individual record ?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2013 22:15:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41178#M9551</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2013-02-22T22:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41179#M9552</link>
      <description>&lt;P&gt;This specific log file is very small. There is no larger example.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2013 23:59:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41179#M9552</guid>
      <dc:creator>barne_dn</dc:creator>
      <dc:date>2013-02-22T23:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41180#M9553</link>
      <description>&lt;P&gt;I tried this out and it worked. But I prefer to manage my configurations through text files. Is there a way to get this working through the transforms.conf?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 15:17:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41180#M9553</guid>
      <dc:creator>barne_dn</dc:creator>
      <dc:date>2013-02-25T15:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41181#M9554</link>
      <description>&lt;P&gt;Do keep in mind, every setting in the manager eventually makes its way into a configuration file. In this case it's an EXTRACT-foo statement in props.conf - you can edit this manually of course.&lt;/P&gt;

&lt;P&gt;I'm sure you can do the same with REPORT-foo and a stanza in transforms.conf, but it feels like more configuration effort for no functionality gain.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 15:36:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41181#M9554</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-02-25T15:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41182#M9555</link>
      <description>&lt;P&gt;That's the thing. I created this through the GUI and looked for the configuration file change but I don't see it. I'm looking in system/local config files. I looked in both the props.conf and transforms.conf. Should I be looking at another props.conf file in one of the other directories? I was under the impression that all changes should be made in the system/local directory.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 18:25:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41182#M9555</guid>
      <dc:creator>barne_dn</dc:creator>
      <dc:date>2013-02-25T18:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41183#M9556</link>
      <description>&lt;P&gt;Don't forget to check the user-specific directories if you didn't set the extraction permissions to global.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 18:38:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41183#M9556</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-02-25T18:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41184#M9557</link>
      <description>&lt;P&gt;It was in my apps/search/local/. Still one more thing bugging me. I'd like to at least test this out by using the transforms.conf. Would you be able to provide me the right syntax so I can compare the results? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 18:42:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41184#M9557</guid>
      <dc:creator>barne_dn</dc:creator>
      <dc:date>2013-02-25T18:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Multiple Values From A Monitored File</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41185#M9558</link>
      <description>&lt;P&gt;It's right here: &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.1/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles#Create_advanced_search-time_field_extractions_with_field_transforms"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.1/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles#Create_advanced_search-time_field_extractions_with_field_transforms&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2013 18:44:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Multiple-Values-From-A-Monitored-File/m-p/41185#M9558</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-02-25T18:44:47Z</dc:date>
    </item>
  </channel>
</rss>

