<?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 Extract json from event if the event contains the string in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Extract-json-from-event-if-the-event-contains-the-string/m-p/491153#M1629</link>
    <description>&lt;P&gt;I have following events in splunk log&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{ [-]
   log: {"@timestamp":"2019-11-18T16:02:16.080-08:00","@version":1,"message":"Files Succesfully Moved To S3 Bucket [20191118-160215~0.txt,  20191118-160215~0.txt.gz, ~20191118-160215~0.txt.gz.done]","logger_name":"FileGenerator","thread_name":"scheduling-1","level":"INFO","level_value":20000,"APP_NAME":"schedule"}

   stream: stdout
   time: 2019-11-19T00:02:16.08107067Z
}
{ [-]
   log: {"@timestamp":"2019-11-19T04:06:07.008-08:00","@version":1,"message":"Processing Ended at 2019-11-19T04:06:07.008-08:00","logger_name":"FileGenerator","thread_name":"scheduling-1","level":"INFO","level_value":20000,"APP_NAME":"schedule"}

   stream: stdout
   time: 2019-11-19T12:06:07.008346529Z
}

{ [-]
   log: {"@timestamp":"2019-11-16T16:00:00.658-08:00","@version":1,"message":"Files Succesfully Moved To S3 Bucket [ 20191116-160000~0.txt,  20191116-160000~0.txt.gz,  20191116-160000~0.txt.gz.done]","logger_name":"FileGenerator","thread_name":"scheduling-1","level":"INFO","level_value":20000,"APP_NAME":"schedule"}

   stream: stdout
   time: 2019-11-17T00:00:00.658656167Z
}

{ [-]
   log: {"@timestamp":"2019-11-15T16:00:00.565-08:00","@version":1,"message":"Files Succesfully Moved To S3 Bucket [ 20191115-160000~1.txt,  20191115-160000~1.txt.gz,  20191115-160000~1.txt.gz.done]","logger_name":"FileGenerator","thread_name":"scheduling-1","level":"INFO","level_value":20000,"APP_NAME":"schedule"}

   stream: stdout
   time: 2019-11-16T00:00:00.566173395Z
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now, I want to extract message,app_name,level from the log only when the message contains the string "Files Succesfully Moved To S3 Bucket".&lt;BR /&gt;I already tried the following query:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;index=d** source=S***  source=u** "Files Succesfully Moved To S3 Bucket" | table APP_NAME,level,message
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but it doesn't returns anything.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2020 14:56:26 GMT</pubDate>
    <dc:creator>karthi25</dc:creator>
    <dc:date>2020-06-10T14:56:26Z</dc:date>
    <item>
      <title>Extract json from event if the event contains the string</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extract-json-from-event-if-the-event-contains-the-string/m-p/491153#M1629</link>
      <description>&lt;P&gt;I have following events in splunk log&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{ [-]
   log: {"@timestamp":"2019-11-18T16:02:16.080-08:00","@version":1,"message":"Files Succesfully Moved To S3 Bucket [20191118-160215~0.txt,  20191118-160215~0.txt.gz, ~20191118-160215~0.txt.gz.done]","logger_name":"FileGenerator","thread_name":"scheduling-1","level":"INFO","level_value":20000,"APP_NAME":"schedule"}

   stream: stdout
   time: 2019-11-19T00:02:16.08107067Z
}
{ [-]
   log: {"@timestamp":"2019-11-19T04:06:07.008-08:00","@version":1,"message":"Processing Ended at 2019-11-19T04:06:07.008-08:00","logger_name":"FileGenerator","thread_name":"scheduling-1","level":"INFO","level_value":20000,"APP_NAME":"schedule"}

   stream: stdout
   time: 2019-11-19T12:06:07.008346529Z
}

{ [-]
   log: {"@timestamp":"2019-11-16T16:00:00.658-08:00","@version":1,"message":"Files Succesfully Moved To S3 Bucket [ 20191116-160000~0.txt,  20191116-160000~0.txt.gz,  20191116-160000~0.txt.gz.done]","logger_name":"FileGenerator","thread_name":"scheduling-1","level":"INFO","level_value":20000,"APP_NAME":"schedule"}

   stream: stdout
   time: 2019-11-17T00:00:00.658656167Z
}

{ [-]
   log: {"@timestamp":"2019-11-15T16:00:00.565-08:00","@version":1,"message":"Files Succesfully Moved To S3 Bucket [ 20191115-160000~1.txt,  20191115-160000~1.txt.gz,  20191115-160000~1.txt.gz.done]","logger_name":"FileGenerator","thread_name":"scheduling-1","level":"INFO","level_value":20000,"APP_NAME":"schedule"}

   stream: stdout
   time: 2019-11-16T00:00:00.566173395Z
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now, I want to extract message,app_name,level from the log only when the message contains the string "Files Succesfully Moved To S3 Bucket".&lt;BR /&gt;I already tried the following query:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;index=d** source=S***  source=u** "Files Succesfully Moved To S3 Bucket" | table APP_NAME,level,message
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but it doesn't returns anything.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:56:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extract-json-from-event-if-the-event-contains-the-string/m-p/491153#M1629</guid>
      <dc:creator>karthi25</dc:creator>
      <dc:date>2020-06-10T14:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract json from event if the event contains the string</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extract-json-from-event-if-the-event-contains-the-string/m-p/491154#M1630</link>
      <description>&lt;P&gt;If they're all in the form of &lt;CODE&gt;"message":"Files Successfully Moved to S3 Bucket*"&lt;/CODE&gt;, have you tried that as your search clause?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 00:52:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extract-json-from-event-if-the-event-contains-the-string/m-p/491154#M1630</guid>
      <dc:creator>aberkow</dc:creator>
      <dc:date>2019-11-20T00:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extract json from event if the event contains the string</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extract-json-from-event-if-the-event-contains-the-string/m-p/491155#M1631</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw=" { 
    \"log\": {\"@timestamp\": \"2019-11-15T16:00:00.565-08:00\",
    \"@version\": 1,
    \"message\": \"Files Succesfully Moved To S3 Bucket [ 20191115-160000~1.txt,  20191115-160000~1.txt.gz,  20191115-160000~1.txt.gz.done]\",
    \"logger_name\": \"FileGenerator\",
    \"thread_name\": \"scheduling-1\",
    \"level\": \"INFO\",
    \"level_value\": 20000,
    \"APP_NAME\": \"schedule\"},
    \"stream\": \"stdout\",
    \"time\": \"2019-11-16T00:00:00.566173395Z\"
 }" 
| spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, As you can see from the example, the field names are different.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=d** source=S***  source=u** "Files Succesfully Moved To S3 Bucket" 
| table log.APP_NAME, log.level, log.message
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How about it?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 01:22:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extract-json-from-event-if-the-event-contains-the-string/m-p/491155#M1631</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-11-20T01:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Extract json from event if the event contains the string</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Extract-json-from-event-if-the-event-contains-the-string/m-p/491156#M1632</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=d** source=S***  source=u** "Files Succesfully Moved To S3 Bucket"
| rename log AS _raw
| kv
| table APP_NAME,level,message
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 23:46:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Extract-json-from-event-if-the-event-contains-the-string/m-p/491156#M1632</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-20T23:46:36Z</dc:date>
    </item>
  </channel>
</rss>

