# Alerting based on the starting line in the log file

**URL:** <https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236>\
**Category:** Alerting\
**Tags:** log-monitoring-class, problems-classic\
**Created:** [April 21, 2024, 3:02pm UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236 "2024-04-21T15:02:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![sundarv1](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@sundarv1](https://community.dynatrace.com/u/sundarv1)\
**Post date:** [April 21, 2024, 3:02pm UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/1 "2024-04-21T15:02:27Z")

</div>

content="ORA-128&nbsp; error "

content=“dynatrace alert ORA-128”

We want to generate alert if “ORA-” starting of the line in log file , not in the middle.&nbsp; How do we do it?.

---

<div class="post-metadata">

**Author:** ![sattilas](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sattilas/32/19702_2.png) [@sattilas](https://community.dynatrace.com/u/sattilas)\
**Post date:** [April 21, 2024, 5:09pm UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/2 "2024-04-21T17:09:56Z")

</div>

Hi sundarv1,

Easiest way is to add a processing rule: If content starts with ORA-, add a field ora.error = “TRUE”, like this:

```markup
USING(content)

| FIELDS_ADD(ora.error:IF_THEN(STARTS(content,"ORA-"),"TRUE"))

```

Based one that field, you can create an events extraction referencing ora.error=“TRUE” in log query.

Hope that helps.

Best,

Attila

---

<div class="post-metadata">

**Author:** ![sundarv1](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@sundarv1](https://community.dynatrace.com/u/sundarv1)\
**Post date:** [April 21, 2024, 5:17pm UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/3 "2024-04-21T17:17:39Z")

</div>

Thanks. Where I do create processing rule. Do I need this condition in the event extraction?

---

<div class="post-metadata">

**Author:** ![sattilas](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sattilas/32/19702_2.png) [@sattilas](https://community.dynatrace.com/u/sattilas)\
**Post date:** [April 21, 2024, 5:26pm UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/4 "2024-04-21T17:26:36Z")

</div>

You can create processing rule under settings/Log monitoring/Processing, you should put the code in processor definition.

 ![sattilas_0-1713720168544.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/0/c05dae04d16a984297c6ddca914a9eee07d0aec3.png)

If the code works, then you can set up Events extraction.

---

<div class="post-metadata">

**Author:** ![sundarv1](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@sundarv1](https://community.dynatrace.com/u/sundarv1)\
**Post date:** [April 22, 2024, 9:31am UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/5 "2024-04-22T09:31:07Z")

</div>

1. How to add to Mutiple logs in the matcher condition.?

2. How to create event extraction based on the processing rule?

3. Do we still needs to create log ingest rules and custom log sources?.

---

<div class="post-metadata">

**Author:** ![sattilas](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sattilas/32/19702_2.png) [@sattilas](https://community.dynatrace.com/u/sattilas)\
**Post date:** [April 23, 2024, 8:35am UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/6 "2024-04-23T08:35:30Z")

</div>

Hi,

Custom log source: You need to add custom log source, if you can not see the log under the Host’s Log source dashlet. DT automatically recognize log files, but not all are automatically recognized.

Ingestion rules: If you want to analyze logs with DT, you have to add log ingest rule, to tell DT, that it should analyze the log file.&nbsp; After log ingest rule enabled, you can see the log content in DT’s Logs dashboard. Otherwise DT won’t analyze the log.

Processing rules: If you want to process the log you captured (for example extract additional attributes, values from content) you have to create processing rules. You can add multiple matcher definitions using AND or OR operators.

Event or Metric extraction: Using attributes you can create Events, alerts, or metrics from the processed log.

This is just a short intoduction to the topic, please refer the documentation.

> **[Log Analytics](https://docs.dynatrace.com/docs/analyze-explore-automate/log-monitoring)**
>
> Log Management and Analytics provides a unified approach to controlling and studying your log data in Dynatrace.

Best,

Attila

---

<div class="post-metadata">

**Author:** ![sundarv1](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@sundarv1](https://community.dynatrace.com/u/sundarv1)\
**Post date:** [April 23, 2024, 9:04am UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/7 "2024-04-23T09:04:13Z")

</div>

Thanks. How to add multiple log file in the log watcher?

---

<div class="post-metadata">

**Author:** ![sundarv1](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@sundarv1](https://community.dynatrace.com/u/sundarv1)\
**Post date:** [April 24, 2024, 3:29pm UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/8 "2024-04-24T15:29:59Z")

</div>

Thanks Sattilas. solution worked.

```auto
FIELDS_ADD(ora.error:IF_THEN(STARTS(content,"ORA-"),"TRUE"))

```

one more request - If it starts with ORA and but if it is ORA-1013 - don;t create alert.

How do we do this.

---

<div class="post-metadata">

**Author:** ![sattilas](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sattilas/32/19702_2.png) [@sattilas](https://community.dynatrace.com/u/sattilas)\
**Post date:** [April 24, 2024, 6:35pm UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/9 "2024-04-24T18:35:37Z")

</div>

Hi,

I’m glad I could help 🙂

The solution to your last question, if it starts with “ORA-”, except “ORA-1013” is:

```markup
FIELDS_ADD(ora.error:IF_THEN(STARTS(content,"ORA-") AND NOT STARTS(content,"ORA-1013"),"TRUE"))

```

Best,

Attila

---

<div class="post-metadata">

**Author:** ![sundarv1](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@sundarv1](https://community.dynatrace.com/u/sundarv1)\
**Post date:** [May 14, 2024, 4:45am UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/10 "2024-05-14T04:45:05Z")

</div>

Hi Sattilas

How do we display host IP Address in the Log Monitoring incdients. Currently we are getting Host name only

Thanks

Sundar.v

---

<div class="post-metadata">

**Author:** ![sundarv1](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@sundarv1](https://community.dynatrace.com/u/sundarv1)\
**Post date:** [July 10, 2024, 3:07pm UTC](https://community.dynatrace.com/t/alerting-based-on-the-starting-line-in-the-log-file/45236/11 "2024-07-10T15:07:00Z")

</div>

How do we map to Servicenow Group to the log monitoring so that incident directly assign to group for log events?
