<?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: help to extract four fields in a log file with regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456455#M129035</link>
    <description>&lt;P&gt;Wow, that's a horrid log!&lt;BR /&gt;
Do you have this data in Splunk already - how does it look, does it get indexed as one event, or broken into multiple events?&lt;/P&gt;

&lt;P&gt;If you can put a copy/paste-able version of the log that would help too.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2019 14:46:00 GMT</pubDate>
    <dc:creator>nickhills</dc:creator>
    <dc:date>2019-03-26T14:46:00Z</dc:date>
    <item>
      <title>help to extract four fields in a log file with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456454#M129034</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6771i3823B51B4CB578AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;A href="https://answers.splunk.comstorage/temp/270916-app2.pdf"&gt;link text&lt;/A&gt;Hi&lt;/P&gt;

&lt;P&gt;I want to extract the four fields after the text in yellow color and in the same line except the last field where I need to have the fields after ../&lt;BR /&gt;
Could you help me to do this please?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 14:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456454#M129034</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-03-26T14:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: help to extract four fields in a log file with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456455#M129035</link>
      <description>&lt;P&gt;Wow, that's a horrid log!&lt;BR /&gt;
Do you have this data in Splunk already - how does it look, does it get indexed as one event, or broken into multiple events?&lt;/P&gt;

&lt;P&gt;If you can put a copy/paste-able version of the log that would help too.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 14:46:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456455#M129035</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2019-03-26T14:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: help to extract four fields in a log file with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456456#M129036</link>
      <description>&lt;P&gt;Any chance you can provide sample data as text, with the sensitive values replaced with representative placeholders? This screenshot is making it a bit difficult to see what exactly the regex should be and also it requires anyone who wants to write a testcase for your question to have to type all that sample data manually from the screenshot.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 14:48:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456456#M129036</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-03-26T14:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: help to extract four fields in a log file with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456457#M129037</link>
      <description>&lt;P&gt;here is the logs&lt;BR /&gt;
I want to extract fields in yellow (see screenshot) and to display them in a table&lt;BR /&gt;
thanks&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;06/09/2018 - 14:21:24 -- Installation of **&lt;/STRONG&gt;&lt;BR /&gt;
14:21:29 ./ Check Product XXXXXXXX&lt;BR /&gt;
         ../ Completed&lt;BR /&gt;
             .../ Not installed&lt;BR /&gt;
 * 14:21:29 ./ Check Disk Size ( must be &amp;gt; to 15 MO)&lt;BR /&gt;
 *       ../ Completed&lt;BR /&gt;
 *           .../ Installation user context: XXXXXXXX&lt;BR /&gt;
14:21:30 ./ Starting 'XXXXXXXX&lt;BR /&gt;
         ../ Completed&lt;BR /&gt;
 * 14:22:13 ./ Starting 'XXXXXXXX Synchro Step 1&lt;BR /&gt;
 *       ../ Completed&lt;BR /&gt;
 * 14:22:42 ./ Starting 'XXXXXXXX Synchro Step 2&lt;BR /&gt;
 *       ../ Failed Error code : ****&lt;BR /&gt;
 * 14:23:01 ./ Starting 'XXXXXXXX Synchro Step 3&lt;BR /&gt;
 *       ../ Failed Error code : 268435509&lt;BR /&gt;
14:23:01 ./ Installation Status&lt;BR /&gt;
         ../ Completed&lt;BR /&gt;
06/09/2018 - 14:23:01 -- End of installation of ****&lt;BR /&gt;
14:23:08 ./ Check Product XXXXXXXX installation Status&lt;BR /&gt;
         ../ ****&lt;BR /&gt;
             .../ *********&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 05:52:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456457#M129037</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-03-27T05:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: help to extract four fields in a log file with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456458#M129038</link>
      <description>&lt;P&gt;Providing the solution as rex commands, shouldn't be too hard to translate that to props/transforms if needed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "Installation\s+of\s+(?&amp;lt;Installation_of&amp;gt;\S+)"
| rex "Failed\s+Error\s+code\s+:\s+(?&amp;lt;Failed_Error_code&amp;gt;\S+)"
| rex "End\s+of\s+installation\s+of\s+(?&amp;lt;End_of_installation_of&amp;gt;\S+)"
| rex "Check\s+Product\s+\S+\s+installation\s+Status\s+\.+\/\s+(?&amp;lt;installation_status&amp;gt;\S+)"
| rex "Check\s+Product\s+\S+\s+installation\s+Status\s+\.+\/\s+\S+\s+\.+\/\s+(?&amp;lt;installation_status2&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Not sure how exactly you like to have those 2 bits of the installation status extracted, I put them into separate fields now. You can easily merge those if you want.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 09:44:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456458#M129038</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-03-27T09:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: help to extract four fields in a log file with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456459#M129039</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
For the first rex perfect&lt;BR /&gt;
For the second almost perfect : sometimes, I have results which are not error code : *, 1 or error code but with a minus sign before&lt;BR /&gt;
and for the other rex, any results&lt;/P&gt;

&lt;P&gt;and furthermore I would like to do something complex&lt;BR /&gt;
In my table, I just want to have a specific line by host and to values the result of the fields below preferably without doubloon&lt;BR /&gt;
Installation_of Failed_Error_code installation_status installation_status2&lt;/P&gt;

&lt;P&gt;thanks for you help&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:49:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456459#M129039</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-09-29T23:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: help to extract four fields in a log file with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456460#M129040</link>
      <description>&lt;P&gt;I'm sorry, I can't make much sense of your comment.&lt;/P&gt;

&lt;P&gt;For the second regex:  \S+ should also match if there is a - before the error code. Please share better sample data, or better explain what is wrong with the suggested regex.&lt;/P&gt;

&lt;P&gt;What do you mean by "and for the other rex, any results"?&lt;/P&gt;

&lt;P&gt;It helps if you could provide a made up sample of what you want the output to look like.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 08:26:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456460#M129040</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-03-28T08:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: help to extract four fields in a log file with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456461#M129041</link>
      <description>&lt;P&gt;by What do you mean by "and for the other rex, any results" I mean that the regex extract anything event if I have result in the log&lt;BR /&gt;
I added an example of what I want in the question&lt;BR /&gt;
for the moment I just want to use 2 fields &lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 09:16:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456461#M129041</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-03-28T09:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: help to extract four fields in a log file with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456462#M129042</link>
      <description>&lt;P&gt;You mean &lt;STRONG&gt;does not&lt;/STRONG&gt; extract anything?&lt;/P&gt;

&lt;P&gt;OK, so get the extractions working and then do a &lt;CODE&gt;| stats list(Installation_of) as Installation_of list(Failed_Error_code) as Failed_Error_code by host&lt;/CODE&gt;. Note: use list, not values, otherwise each multivalue field is lexicographically sorted and you loose the relation between installation and error code.&lt;/P&gt;

&lt;P&gt;If you need further help getting the extractions working, please be more clear in what the problem is with the suggested regex and provide more representative sample data (especially of the cases where the regex currently fails).&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 09:32:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-to-extract-four-fields-in-a-log-file-with-regex/m-p/456462#M129042</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-03-28T09:32:48Z</dc:date>
    </item>
  </channel>
</rss>

