<?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 Log processing rules : how to set newfeild=success by checking if a key exist in Parsed JSON in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Log-processing-rules-how-to-set-newfeild-success-by-checking-if/m-p/225886#M306</link>
    <description>&lt;P&gt;is it possible to add a field to logs by check if a KEY exist in a Parsed JSON while processing logs,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;JSON SAMPLE :&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;"name" : "test"&lt;/P&gt;&lt;P&gt;"action" : "some random string"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;&lt;BR /&gt;requirement : add a new_feild as log attribute if json contains a key named "action"&lt;BR /&gt;&lt;BR /&gt;PARSE(content,"JSON:data") |&lt;BR /&gt;FIELDS_ADD( new_feild: IF{ ???? })&lt;/P&gt;</description>
    <pubDate>Wed, 18 Oct 2023 17:07:43 GMT</pubDate>
    <dc:creator>pallepavan</dc:creator>
    <dc:date>2023-10-18T17:07:43Z</dc:date>
    <item>
      <title>Log processing rules : how to set newfeild=success by checking if a key exist in Parsed JSON</title>
      <link>https://community.dynatrace.com/t5/DQL/Log-processing-rules-how-to-set-newfeild-success-by-checking-if/m-p/225886#M306</link>
      <description>&lt;P&gt;is it possible to add a field to logs by check if a KEY exist in a Parsed JSON while processing logs,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;JSON SAMPLE :&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;"name" : "test"&lt;/P&gt;&lt;P&gt;"action" : "some random string"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;&lt;BR /&gt;requirement : add a new_feild as log attribute if json contains a key named "action"&lt;BR /&gt;&lt;BR /&gt;PARSE(content,"JSON:data") |&lt;BR /&gt;FIELDS_ADD( new_feild: IF{ ???? })&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 17:07:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Log-processing-rules-how-to-set-newfeild-success-by-checking-if/m-p/225886#M306</guid>
      <dc:creator>pallepavan</dc:creator>
      <dc:date>2023-10-18T17:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Log processing rules : how to set newfeild=success by checking if a key exist in Parsed JSON</title>
      <link>https://community.dynatrace.com/t5/DQL/Log-processing-rules-how-to-set-newfeild-success-by-checking-if/m-p/226901#M320</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/66885"&gt;@pallepavan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yep, you can do that. You don't even need to parse your json, assuming the string 'action' is not present anywhere.&lt;/P&gt;&lt;P&gt;|fieldsAdd hasaction = contains(content,"action")&lt;/P&gt;&lt;P&gt;This will add a 'hasaction' field as boolean (true/false) to your results. Then you can use it in your IF condition, to add a new field with some other log attribute.&lt;/P&gt;&lt;P&gt;Check this doc to get more details: &lt;A href="https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/functions#if" target="_blank" rel="noopener"&gt;https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/functions#if&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 21:06:11 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Log-processing-rules-how-to-set-newfeild-success-by-checking-if/m-p/226901#M320</guid>
      <dc:creator>dannemca</dc:creator>
      <dc:date>2023-10-27T21:06:11Z</dc:date>
    </item>
  </channel>
</rss>

