Splunk Enterprise

How to combine queries to use for alert?

vishwa
Path Finder

I have 3 queries , i want to combine to one query so that i can use it for alert

Query1:
index=error-data  sourcetype=error:logs  source=https://error:appliocation.logs
"logs started"   "tarnsaction recevied"
[|inputlookup append=t  errorlogs.csv where error=2
|fields host
|format]
|stats count as "initial error logs "

Query2:
index=error-data  sourcetype=error:logs  source=https://error:appliocation.logs
" timeouterror" AND "failed logs confirmed "
[|inputlookup append=t  errorlogs.csv where error=2
|fields host
|format]
|stats count as "logs in transactions "

Query3:
index=error-data  sourcetype=error:logs  source=https://error:appliocation.logs
" application logs continuted"
[|inputlookup append=t  errorlogs.csv where error=2
|fields host
|format]
|stats count as "total failed"

Labels (1)
Tags (2)
0 Karma

vishwa
Path Finder

Hi @richgalloway .

, thank you it worked.

I have one more question is there any way I can restrict events in splunk

For example From the above query if I get 10 same logs in 1 hour

How can I write a query to fetch

only 5 records in 1 hour

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I don't know how to do that.

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

richgalloway
SplunkTrust
SplunkTrust

See if this helps

index=error-data  sourcetype=error:logs  source=https://error:appliocation.logs
("logs started"   "tarnsaction recevied") OR (" timeouterror" AND "failed logs confirmed ") OR (" application logs continuted")
[|inputlookup append=t  errorlogs.csv where error=2
|fields host
|format]
| eval initialError=if(searchmatch("logs started" AND "tarnsaction recevied"),1,0)
| eval transLogs=if(searchmatch(" timeouterror" AND "failed logs confirmed "),1, 0)
| eval Failed=if(searchmatch(" application logs continuted"), 1,0)
|stats count(eval(initialError=1)) as "initial error logs ", count(eval(transLogs=1) as "logs in transactions", count(eval(failed=1) as "total failed"
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Transforming Financial Data into Fraud Intelligence

Every day, banks and financial companies handle millions of transactions, logins, and customer interactions ...

How to send events & findings from AWS to Splunk using Amazon EventBridge

Amazon EventBridge is a serverless service that uses events to connect application components together, making ...

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...