<?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: How to extract fields from a multi line messages in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96639#M24980</link>
    <description>&lt;P&gt;These are the 2 options I would try&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;configuration files&lt;/LI&gt;
&lt;LI&gt;rex command in the search bar&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The easiest, but also most transient, option is to use rex command inline in your search.  For example:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype="multiline" | rex "CLOSE, loaded in (?&amp;lt;close_pe_rt&amp;gt;\S+)" | rex "FX_CLOSE, loaded in (?&amp;lt;fx_close_pe_rt&amp;gt;\S+)" | rex "XLA_ENV, loaded in (?&amp;lt;xla_env_pe_rt&amp;gt;\S+)" | rex "INTRADAY, loaded in (?&amp;lt;intraday_pe_rt&amp;gt;\S+)" | rex "CPTY_CREDIT, loaded in (?&amp;lt;cpty_credit_pe_rt&amp;gt;\S+)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Maybe there's a way to do this in one rex invocation, but I tried several things which didn't work.&lt;/P&gt;

&lt;P&gt;The other option is to add a few stanzas to props.conf and transforms.conf.  For example,&lt;/P&gt;

&lt;P&gt;in props.conf:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[multiline]
REPORT-foo = mlFields&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;in transforms.conf:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[mlFields]
REGEX = CLOSE, loaded in (\S+).* FX_CLOSE, loaded in (\S+).* XLA_ENV, loaded in (\S+).* INTRADAY, loaded in (\S+).* CPTY_CREDIT, loaded in (\S+)
FORMAT = close_pe_rt::$1 fx_close_pe_rt::$2 xla_env_pe_rt::$3 intraday_pe_rt::$4 cpty_credit_pe_rt::$5&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You could also try using the Interactive Field Extractor (IFX).&lt;/P&gt;</description>
    <pubDate>Wed, 01 Dec 2010 07:54:14 GMT</pubDate>
    <dc:creator>hulahoop</dc:creator>
    <dc:date>2010-12-01T07:54:14Z</dc:date>
    <item>
      <title>How to extract fields from a multi line messages</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96637#M24978</link>
      <description>&lt;P&gt;We have a multi line message that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;11/30/10 16:28:34 Verifying pricing env CLOSE,FX_CLOSE,XLA_ENV,INTRADAY,CPTY_CREDIT
   No exceptions for CLOSE, loaded in 0.05 secs
   Messages for FX_CLOSE
      PricerConfigRefresh: No item found for 1246892/CurveZero (CLOSE)  before Tue Nov 30 16:28:34 EST 2010
   No exceptions for FX_CLOSE, loaded in 0.17 secs
   No exceptions for XLA_ENV, loaded in 0.05 secs
   No exceptions for INTRADAY, loaded in 0.10 secs
   No exceptions for CPTY_CREDIT, loaded in 0.40 sec
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to create the following fields and assign the numeric values as response time, so I can search and chart on the RT values. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  close_pe_rt=0.05
  fx_close_pe_rt=0.17
  xla_env_pe_rt=0.05
  intraday_pe_rt=0.10
  cpty_credit_pe_rt=0.40
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What is the best way to handle such extraction and assignments?&lt;/P&gt;

&lt;P&gt;Thanks very much for your help,
Jean&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2010 06:20:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96637#M24978</guid>
      <dc:creator>jdagenais</dc:creator>
      <dc:date>2010-12-01T06:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a multi line messages</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96638#M24979</link>
      <description>&lt;P&gt;You can either use multiple regular expressions (multiple rex command calls or multiple EXTRACT-* options in props.conf) or a single regex with the &lt;CODE&gt;(?m)&lt;/CODE&gt; multiline flag (maybe as well the &lt;CODE&gt;(?s)&lt;/CODE&gt; DOTALL flag).&lt;/P&gt;

&lt;P&gt;Someting like this might work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(?ms)No exceptions for CLOSE, loaded in (?&amp;lt;close_pe_rt&amp;gt;[\d\.]+).+FX_CLOSE, loaded in (?&amp;lt;fx_close_pe_rt&amp;gt;[\d\.]+).+XLA_ENV, loaded in (?&amp;lt;xla_env_pe_rt&amp;gt;[\d\.]+).+INTRADAY, loaded in (?&amp;lt;intraday_pe_rt&amp;gt;[\d\.]+).+CPTY_CREDIT, loaded in (?&amp;lt;cpty_credit_pe_rt&amp;gt;[\d\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Dec 2010 07:53:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96638#M24979</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2010-12-01T07:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a multi line messages</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96639#M24980</link>
      <description>&lt;P&gt;These are the 2 options I would try&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;configuration files&lt;/LI&gt;
&lt;LI&gt;rex command in the search bar&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The easiest, but also most transient, option is to use rex command inline in your search.  For example:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype="multiline" | rex "CLOSE, loaded in (?&amp;lt;close_pe_rt&amp;gt;\S+)" | rex "FX_CLOSE, loaded in (?&amp;lt;fx_close_pe_rt&amp;gt;\S+)" | rex "XLA_ENV, loaded in (?&amp;lt;xla_env_pe_rt&amp;gt;\S+)" | rex "INTRADAY, loaded in (?&amp;lt;intraday_pe_rt&amp;gt;\S+)" | rex "CPTY_CREDIT, loaded in (?&amp;lt;cpty_credit_pe_rt&amp;gt;\S+)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Maybe there's a way to do this in one rex invocation, but I tried several things which didn't work.&lt;/P&gt;

&lt;P&gt;The other option is to add a few stanzas to props.conf and transforms.conf.  For example,&lt;/P&gt;

&lt;P&gt;in props.conf:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[multiline]
REPORT-foo = mlFields&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;in transforms.conf:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[mlFields]
REGEX = CLOSE, loaded in (\S+).* FX_CLOSE, loaded in (\S+).* XLA_ENV, loaded in (\S+).* INTRADAY, loaded in (\S+).* CPTY_CREDIT, loaded in (\S+)
FORMAT = close_pe_rt::$1 fx_close_pe_rt::$2 xla_env_pe_rt::$3 intraday_pe_rt::$4 cpty_credit_pe_rt::$5&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You could also try using the Interactive Field Extractor (IFX).&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2010 07:54:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96639#M24980</guid>
      <dc:creator>hulahoop</dc:creator>
      <dc:date>2010-12-01T07:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a multi line messages</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96640#M24981</link>
      <description>&lt;P&gt;Note: I did not have to use the (?m) regex modifier in the REGEX field for transforms.conf.  Somewhere along the way, Splunk automatically knows how to deal with multiline events.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2010 07:57:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96640#M24981</guid>
      <dc:creator>hulahoop</dc:creator>
      <dc:date>2010-12-01T07:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from a multi line messages</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96641#M24982</link>
      <description>&lt;P&gt;Thank you very much.&lt;/P&gt;

&lt;P&gt;This solution worked quite well and I implemented it with the props.conf and transforms.conf.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2010 23:22:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-a-multi-line-messages/m-p/96641#M24982</guid>
      <dc:creator>jdagenais</dc:creator>
      <dc:date>2010-12-02T23:22:44Z</dc:date>
    </item>
  </channel>
</rss>

