<?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 my log when every record in the log has different position of the field? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-fields-from-my-log-when-every-record-in-the-log/m-p/360304#M92950</link>
    <description>&lt;P&gt;Hi varunchhabra,&lt;BR /&gt;
if your logs have a limited number of types you can build one extraction for each situation (FunctionCalled1, FunctionCalled2, FunctionCalledn) and then configure a calculated field as a coalesce field or an eval command&lt;BR /&gt;
| eval FunctionCalled=coalesce(FunctionCalled1, FunctionCalled2,...,FunctionCalledn).&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2017 13:24:02 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-05-03T13:24:02Z</dc:date>
    <item>
      <title>How to extract fields from my log when every record in the log has different position of the field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-fields-from-my-log-when-every-record-in-the-log/m-p/360302#M92948</link>
      <description>&lt;P&gt;I have a log file that contains time stamped events. The type of action done is defined by the string parameter like : FunctionCalled.&lt;BR /&gt;
I want to extract the action field and use it. But the problem is that the keywords are not following any pattern. It could be like:&lt;/P&gt;

&lt;P&gt;TimeStamp1  FunctionCalled&lt;BR /&gt;
TimeStamp2 ABC::CDE&amp;lt;&amp;gt;FunctionCalledAgain&lt;/P&gt;

&lt;P&gt;In such case, the neither the regex nor delimited pattern helping me to get the field.&lt;/P&gt;

&lt;P&gt;On the side note, Is it necessary for the log to be ordered so as to apply generic statistical functions?&lt;/P&gt;

&lt;P&gt;Plz help.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 12:53:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-fields-from-my-log-when-every-record-in-the-log/m-p/360302#M92948</guid>
      <dc:creator>varunchhabra</dc:creator>
      <dc:date>2017-05-03T12:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from my log when every record in the log has different position of the field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-fields-from-my-log-when-every-record-in-the-log/m-p/360303#M92949</link>
      <description>&lt;P&gt;How many of above patterns may exist? If there is no way for you to come up with regular expression, &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Option 1&lt;/STRONG&gt;&lt;BR /&gt;
You create separate Field Extractions for FunctionalCalled say FunctionalCalled1 and FunctionalCalled2 etc and then use the following in your query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt; FunctionalCalled1="FunctionalCalled" OR FunctionalCalled2="FunctionalCalled"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Option 2&lt;/STRONG&gt;&lt;BR /&gt;
If you do not want to perform field extraction then in base search you can use &lt;CODE&gt;"FunctionalCalled"&lt;/CODE&gt; and in your subsequent pipe you can use &lt;CODE&gt;searchmatch&lt;/CODE&gt; to create your own field with &lt;STRONG&gt;eval&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval FunctionalCalled1=case(searchmatch("FunctionalCalled"),"FunctionalCalled",true(),"Other")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ideally, interesting fields should be a key value pair, you should also read Logging best practices in order to better utilize Splunk's capabilities: &lt;A href="http://dev.splunk.com/view/logging/SP-CAAAFCK"&gt;http://dev.splunk.com/view/logging/SP-CAAAFCK&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 13:16:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-fields-from-my-log-when-every-record-in-the-log/m-p/360303#M92949</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-05-03T13:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from my log when every record in the log has different position of the field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-fields-from-my-log-when-every-record-in-the-log/m-p/360304#M92950</link>
      <description>&lt;P&gt;Hi varunchhabra,&lt;BR /&gt;
if your logs have a limited number of types you can build one extraction for each situation (FunctionCalled1, FunctionCalled2, FunctionCalledn) and then configure a calculated field as a coalesce field or an eval command&lt;BR /&gt;
| eval FunctionCalled=coalesce(FunctionCalled1, FunctionCalled2,...,FunctionCalledn).&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 13:24:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-fields-from-my-log-when-every-record-in-the-log/m-p/360304#M92950</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-05-03T13:24:02Z</dc:date>
    </item>
  </channel>
</rss>

