<?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: Regex : Keep  Left Indention in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438527#M124803</link>
    <description>&lt;P&gt;Hi, Thanks a lot. I am a bit under the weather today, but I feel we are pretty near, the issue here is I am trying this on _raw field and I have to as these are raw log entries. So, how can I assign a field name here?&lt;BR /&gt;
If i assign _raw it of course takes all the events AND I have to apply this to the _raw events.&lt;BR /&gt;
Just one step away I guess :)?&lt;/P&gt;</description>
    <pubDate>Sat, 14 Jul 2018 09:20:24 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2018-07-14T09:20:24Z</dc:date>
    <item>
      <title>Regex : Keep  Left Indention</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438523#M124799</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I have logs like this : &lt;CODE&gt;&lt;BR /&gt;
Exception in thread "main" java.lang.RuntimeException: Some other message&lt;BR /&gt;
    at Exceptions.main(Exceptions.java:4)&lt;BR /&gt;
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;BR /&gt;
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&lt;BR /&gt;
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;BR /&gt;
    at java.lang.reflect.Method.invoke(Method.java:498)&lt;BR /&gt;
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)&lt;BR /&gt;
Caused by: java.lang.RuntimeException: Some message&lt;BR /&gt;
    at Exceptions.main(Exceptions.java:3)&lt;/CODE&gt;&lt;BR /&gt;
These are my raw events and I am able to extract them using regex, my issue is the left indentation for the first line and "Caused by" is of course, missing when i extract them using regex. Currently my regex return something like this:&lt;CODE&gt;&lt;BR /&gt;
    Exception in thread "main" java.lang.RuntimeException: Some other message&lt;BR /&gt;
    at Exceptions.main(Exceptions.java:4)&lt;BR /&gt;
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;BR /&gt;
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&lt;BR /&gt;
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;BR /&gt;
    at java.lang.reflect.Method.invoke(Method.java:498)&lt;BR /&gt;
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)&lt;BR /&gt;
    Caused by: java.lang.RuntimeException: Some message&lt;BR /&gt;
    at Exceptions.main(Exceptions.java:3)&lt;/CODE&gt;&lt;BR /&gt;
Is there a way to preserve the left indentation wherever applicable?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jul 2018 07:33:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438523#M124799</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-07-14T07:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regex : Keep  Left Indention</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438524#M124800</link>
      <description>&lt;P&gt;You can use rex in sed mode to remove spaces at the beginning of lines in your field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=yourFieldName mode=sed “s/^\s+//g”
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Jul 2018 08:45:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438524#M124800</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-07-14T08:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Regex : Keep  Left Indention</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438525#M124801</link>
      <description>&lt;P&gt;Hi yes, the sed mode is one option, and I was not clear on stating my initial needs. I meant , can something apply to this extraction in specific only?&lt;BR /&gt;
I have other raw fields with lines having indentation and I do not want them to retain their original indents. The other set should come without indents. When i apply the sed regex above it applies to all my raw events, and i don't want that&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jul 2018 08:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438525#M124801</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-07-14T08:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regex : Keep  Left Indention</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438526#M124802</link>
      <description>&lt;P&gt;Change field=yourFieldName to the field name that you want to apply this to.  By default it uses _raw which is all the data.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jul 2018 09:16:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438526#M124802</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-07-14T09:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Regex : Keep  Left Indention</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438527#M124803</link>
      <description>&lt;P&gt;Hi, Thanks a lot. I am a bit under the weather today, but I feel we are pretty near, the issue here is I am trying this on _raw field and I have to as these are raw log entries. So, how can I assign a field name here?&lt;BR /&gt;
If i assign _raw it of course takes all the events AND I have to apply this to the _raw events.&lt;BR /&gt;
Just one step away I guess :)?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jul 2018 09:20:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438527#M124803</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-07-14T09:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Regex : Keep  Left Indention</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438528#M124804</link>
      <description>&lt;P&gt;I’m confused.  Can you share a screenshot of your search and the results?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jul 2018 11:16:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438528#M124804</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-07-14T11:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regex : Keep  Left Indention</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438529#M124805</link>
      <description>&lt;P&gt;I cover this in in this Q&amp;amp;A but the problem is that Splunk presents newlines in data as spaces and there is NO way to change this.  The work-around is to split the field into a multi-valued field at each newline:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/560325/fix-loss-of-text-formatting-in-dashboard-table-fie.html"&gt;https://answers.splunk.com/answers/560325/fix-loss-of-text-formatting-in-dashboard-table-fie.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jul 2018 22:00:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Keep-Left-Indention/m-p/438529#M124805</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-14T22:00:57Z</dc:date>
    </item>
  </channel>
</rss>

