<?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 How do I fetch data from an existing field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-fetch-data-from-an-existing-field/m-p/400753#M167411</link>
    <description>&lt;P&gt;I have a field in my log which contains a huge text data with two different formats. I tried to catch a few parts in a new field but was unable to get all the data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;First type
------------------------------------
Timestamp=26/SEP/2018 16:37:38 UTC|DBA_GROUP=X2Oracle_NSS|TOWER=NSS|DB_INSTANCE_NAME=lsrprod|DB_HOST_NAME=ABC|UAID=0|TABLE_OWNER=STAGE|TABLE_NAME=NFMDAT|PARTITION_POSITION=6|PARTITION=P2018|HIGH_VALUE=TTO_DATE(' 2019-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')|PREV_HIGH_VALUE=TTO_DATE(' 2018-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')

Second type
-------------------------------------------------
Timestamp=26/SEP/2018 16:01:06 UTC|DBA_GROUP=X2Oracle_GFS|TOWER=GFS|DB_INSTANCE_NAME=ecs02prd|DB_HOST_NAME=ASD|UAID=UDBID-15360|TABLE_OWNER=ECSREFRESH_EXCEPTION|TABLE_NAME=ECS_TRAN_AUDIT_HSTR_BKP|PARTITION_POSITION=27|PARTITION=ECSTRANAUDTHSTR_20170430|HIGH_VALUE=TIMESTAMP' 2017-05-01 00:00:00'|PREV_HIGH_VALUE=TIMESTAMP' 2017-04-01 00:00:00'
partition_check_En_Time=12:01:07 PM
End_Time: Wed Sep 26 12:01:07 EDT 2018
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I used the below query to get the new field from above log.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search  | eval Current_High_Value=substr(HIGH_VALUE, 11, 20) | eval Previous_High_Value=substr(PREV_HIGH_VALUE, 11, 20)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am getting value properly for Current_High_Value field but not getting complete data in Previous_High_Value. Its not picking data for second type of log.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 21:26:35 GMT</pubDate>
    <dc:creator>twh1</dc:creator>
    <dc:date>2020-09-29T21:26:35Z</dc:date>
    <item>
      <title>How do I fetch data from an existing field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-fetch-data-from-an-existing-field/m-p/400753#M167411</link>
      <description>&lt;P&gt;I have a field in my log which contains a huge text data with two different formats. I tried to catch a few parts in a new field but was unable to get all the data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;First type
------------------------------------
Timestamp=26/SEP/2018 16:37:38 UTC|DBA_GROUP=X2Oracle_NSS|TOWER=NSS|DB_INSTANCE_NAME=lsrprod|DB_HOST_NAME=ABC|UAID=0|TABLE_OWNER=STAGE|TABLE_NAME=NFMDAT|PARTITION_POSITION=6|PARTITION=P2018|HIGH_VALUE=TTO_DATE(' 2019-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')|PREV_HIGH_VALUE=TTO_DATE(' 2018-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')

Second type
-------------------------------------------------
Timestamp=26/SEP/2018 16:01:06 UTC|DBA_GROUP=X2Oracle_GFS|TOWER=GFS|DB_INSTANCE_NAME=ecs02prd|DB_HOST_NAME=ASD|UAID=UDBID-15360|TABLE_OWNER=ECSREFRESH_EXCEPTION|TABLE_NAME=ECS_TRAN_AUDIT_HSTR_BKP|PARTITION_POSITION=27|PARTITION=ECSTRANAUDTHSTR_20170430|HIGH_VALUE=TIMESTAMP' 2017-05-01 00:00:00'|PREV_HIGH_VALUE=TIMESTAMP' 2017-04-01 00:00:00'
partition_check_En_Time=12:01:07 PM
End_Time: Wed Sep 26 12:01:07 EDT 2018
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I used the below query to get the new field from above log.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search  | eval Current_High_Value=substr(HIGH_VALUE, 11, 20) | eval Previous_High_Value=substr(PREV_HIGH_VALUE, 11, 20)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am getting value properly for Current_High_Value field but not getting complete data in Previous_High_Value. Its not picking data for second type of log.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:26:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-fetch-data-from-an-existing-field/m-p/400753#M167411</guid>
      <dc:creator>twh1</dc:creator>
      <dc:date>2020-09-29T21:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I fetch data from an existing field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-fetch-data-from-an-existing-field/m-p/400754#M167412</link>
      <description>&lt;P&gt;You can use rex command to get Previous high value-&lt;/P&gt;

&lt;P&gt;rex field=PREV_HIGH_VALUE "\W+\s+(?\d{4}-\d{2}-\d{2})"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:26:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-fetch-data-from-an-existing-field/m-p/400754#M167412</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2020-09-29T21:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I fetch data from an existing field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-fetch-data-from-an-existing-field/m-p/400755#M167413</link>
      <description>&lt;P&gt;I have used below query and getting value properly.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | eval Current_High_Value=substr(HIGH_VALUE, 11, 20) 
        | rex "^(?:[^ \n]* ){5}(?P&amp;lt;Pre_High_Value&amp;gt;[^']+)"
        | eval Previous_High_Value= case(like(PREV_HIGH_VALUE, "TTO_DATE%"), substr(PREV_HIGH_VALUE, 11, 20), like(PREV_HIGH_VALUE, "TIMESTAMP%"), Pre_High_Value) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Sep 2018 11:11:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-fetch-data-from-an-existing-field/m-p/400755#M167413</guid>
      <dc:creator>twh1</dc:creator>
      <dc:date>2018-09-27T11:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I fetch data from an existing field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-fetch-data-from-an-existing-field/m-p/400756#M167414</link>
      <description>&lt;P&gt;Thanks @Vijeta &lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 16:58:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-fetch-data-from-an-existing-field/m-p/400756#M167414</guid>
      <dc:creator>twh1</dc:creator>
      <dc:date>2018-10-11T16:58:08Z</dc:date>
    </item>
  </channel>
</rss>

