Alerting

How can I get the message alert in mail showing only the failed job example instead of the complete log?

kc_prane
Path Finder

How Can i just get the message alert in mail showing only the  failed job example "Job=[ADM-FILENET-DLY]] " instead of the complete log.   Note: The Job names are dynamic 

 

My Current Alert Query :

index=*  host=*MYhost*    "*IN-RCMCO-DLY*"  OR  "*ADJ-RECERT-DLY*"  OR  *AD*-*Y*"   FAILED job_status2=FAILED OR status=FAILED OR status1=FAILED OR ExitCode=FAILED | rex field=_raw ".*status:\s\[(?P<status1>\S+)\]" | rex field=_raw "JOB\s(?P<job_status2>\w+)" |rex field=_raw "(exitCode=)(?<ExitCode>\w+)"
| eval _raw=substr(_raw, 1, 1500)
| table _time job_status2 status1 status ExitCode _raw

 

log 

22-08-28 18:01:31,323 INFO [main] c.l.b.listener.JobCompletionListener: :::::::::::::::BATCH JOB FAILED:::::::::::JobExecution: id=21099, version=1, startTime=Sun Aug 28 18:01:29 CDT 2022, endTime=Sun Aug 28 18:01:31 CDT 2022, lastUpdated=Sun Aug 28 18:01:29 CDT 2022, status=FAILED, exitStatus=exitCode=FAILED;exitDescription=com.ltss.fw.exception.ApplicationException: Error occured while processing appDocument: In catch block, exception stackTrace,job=[JobInstance: id=21099, version=0, Job=[ADM-FILENET-DLY]], jobParameters=[{chunkSize=null, skipLimit=null, commitInterval=null, time=1661727689449, asOfDate=1661662800000}]

Labels (1)
Tags (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The alert mechanism cannot edit your results for you.  You must modify the search to return only the results you want in the message.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

kc_prane
Path Finder

Hi @richgalloway, thanks for the response. Iam looking for search results in the mail but not the complete search results  but want only the  failed job name : "Job=[ADM-FILENET-DLY]]"

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The alert mechanism cannot edit your results for you.  You must modify the search to return only the results you want in the message.

---
If this reply helps you, Karma would be appreciated.

richgalloway
SplunkTrust
SplunkTrust

Edit the alert and deselect the box the "Inline" box to prevent Splunk from putting the search results in the alert message.  By default, the alert name is part of the subject field, as shown below

richgalloway_0-1661793075391.png

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...