# Having trouble adding a field to a record within grail via a processing rule

**URL:** <https://community.dynatrace.com/t/having-trouble-adding-a-field-to-a-record-within-grail-via-a-processing-rule/44594>\
**Category:** DQL\
**Tags:** dql, extensions, logs\
**Created:** [March 12, 2024, 3:10pm UTC](https://community.dynatrace.com/t/having-trouble-adding-a-field-to-a-record-within-grail-via-a-processing-rule/44594 "2024-03-12T15:10:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivart\_89](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@sivart\_89](https://community.dynatrace.com/u/sivart_89)\
**Post date:** [March 12, 2024, 3:10pm UTC](https://community.dynatrace.com/t/having-trouble-adding-a-field-to-a-record-within-grail-via-a-processing-rule/44594/1 "2024-03-12T15:10:01Z")

</div>

I’m trying to add field **error.type** &nbsp;when specific messages occur within sfm records, within a custom 2.0 extension I have created. I’ve defined the processing rule below.

When&nbsp; **Connection exists but no metrics have been produced for endpoints:** &nbsp;is logged in the content it works fine, error.type of **Connection exists but no metrics have been produced** &nbsp;is added to the record. Whenever **Exception occured: IO Error: The Network Adapter could not establish the connection** &nbsp;is logged in the content, there is no error.type added. When viewing the record in grail I see null for error.type while for the other I can see the value I expect. What am I doing wrong here? I can put in the log for this error type and test it against the rule and the error.type does show, see screenshot below.

**Matcher**  
 (matchesValue(event.type, “sfm”) and matchesPhrase(dt.extension.name, “custom:db.queries.oracle”)  
and (matchesPhrase(content, “Exception occured: ORA-01017: invalid username/password; logon denied”)  
or matchesPhrase(content, “Exception occured: IO Error: The Network Adapter could not establish the connection”)  
or matchesPhrase(content, “Failed to configure and schedule polling for endpoint”)  
or matchesPhrase(content, “Error in YAML or JSON configuration; Datasource has exited and will be starting shortly”)  
or matchesPhrase(content, “query have failed”)  
or matchesPhrase(content, “Connection exists but no metrics have been produced for endpoints:”)  
or matchesPhrase(content, “No feature set is activated for”)))

**Process definition**  
FIELDS\_ADD(content, error.type:IF\_THEN\_ELSE(content CONTAINS(“Exception occured: ORA-01017: invalid username/password; logon denied”), “Invalid username/password”,  
IF\_THEN\_ELSE(content CONTAINS(“Exception occured: IO Error: The Network Adapter could not establish the connection”), “Cannot connect to database”,  
IF\_THEN\_ELSE(content CONTAINS(“Failed to configure and schedule polling for endpoint”), “Failed to configure and schedule polling for endpoint”,  
IF\_THEN\_ELSE(content CONTAINS(“Error in YAML or JSON configuration; Datasource has exited and will be starting shortly”), “Error in YAML or JSON configuration”,  
IF\_THEN\_ELSE(content CONTAINS(“Connection exists but no metrics have been produced for endpoints:”), “Connection exists but no metrics have been produced”,  
IF\_THEN\_ELSE(content CONTAINS(“No feature set is activated for”), “No feature set activated”,  
IF\_THEN\_ELSE(content CONTAINS(“query have failed”), “Query failed”))))))))

 ![sivart_89_0-1710256017787.png](https://global.discourse-cdn.com/dynatrace/original/2X/3/3e69452c8477b512ac7fac5fe213a507de5a8551.png)

---

<div class="post-metadata">

**Author:** ![thomas\_billi](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/thomas_billi/32/25487_2.png) [@thomas\_billi](https://community.dynatrace.com/u/thomas_billi)\
**Post date:** [November 20, 2024, 10:31am UTC](https://community.dynatrace.com/t/having-trouble-adding-a-field-to-a-record-within-grail-via-a-processing-rule/44594/2 "2024-11-20T10:31:51Z")

</div>

Is this still an issue?

---

<div class="post-metadata">

**Author:** ![mosharref\_hossn](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mosharref_hossn/32/32184_2.png) [@mosharref\_hossn](https://community.dynatrace.com/u/mosharref_hossn)\
**Post date:** [November 20, 2024, 3:39pm UTC](https://community.dynatrace.com/t/having-trouble-adding-a-field-to-a-record-within-grail-via-a-processing-rule/44594/3 "2024-11-20T15:39:24Z")

</div>

Try this based on the “CONTAINS” function rule.

Also, I would recommend reduce the matcher string into more unique values instead of the entire line of text.

```markup
FIELDS_ADD(error.type:IF_THEN_ELSE(CONTAINS(content, "Exception occured: ORA-01017: invalid username/password; logon denied"), "Invalid username/password",
IF_THEN_ELSE(CONTAINS(content, "Exception occured: IO Error: The Network Adapter could not establish the connection"), "Cannot connect to database",
IF_THEN_ELSE(CONTAINS(content, "Failed to configure and schedule polling for endpoint"), "Failed to configure and schedule polling for endpoint",
IF_THEN_ELSE(CONTAINS(content, "Error in YAML or JSON configuration; Datasource has exited and will be starting shortly"), "Error in YAML or JSON configuration",
IF_THEN_ELSE(CONTAINS(content , "Connection exists but no metrics have been produced for endpoints:"), "Connection exists but no metrics have been produced",
IF_THEN_ELSE(CONTAINS(content, "No feature set is activated for"), "No feature set activated",
IF_THEN_ELSE(CONTAINS(content, "query have failed"), "Query failed"))))))))

```

![mosharref_hossn_0-1732116952216.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/8/a847c415d6f54c7e004dca463201f8f6f232c154.png)
