Alerting

How to use collect in an alert

splunk_down
New Member

i have an alert that send email to my id when the event is triggered.
I also want the same alert to dump the data into my summary index.

I added | collect index=sumindex
at the end of my alert.

Alert still works and fires email, but is not writing anything to the summary index.

Can anyone help me where I am wrong or has a better way.

Tags (1)
0 Karma

splunk_down
New Member

Found a solution, but with splunk 7.0

It gives an option to output search resuts to a lookup.

I can then use the lookup to display the result.

Thanx for all the help...

0 Karma

niketn
Legend

@splunk_down, I have converted your comment to Answer. Please accept the same to mark this question as answered.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

@splunk_down, collect command will work with real-time searches with All Time as selection. Refer to documentation: https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Collect#Usage

does your search return single row or multiple? If it returns single row, you can use Alert Action to write to index directly using Alert Actions to Log Events and use default token for custom Alert Action: http://docs.splunk.com/Documentation/Splunk/latest/Alert/LogEvents
http://docs.splunk.com/Documentation/Splunk/latest/Alert/EmailNotificationTokens#Result_tokens

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

elliotproebstel
Champion

Does the summary index already exist? Have you tried searching a larger time window than you think you need? In my experience, if I have a scheduled search that collects events into a summary index, the events will often be timestamped with the earliest time in the search window. (So, for example, if I searched noon-4pm, the events will be timestamped noon, even if they actually took place near 4pm.)

splunk_down
New Member

yes the summary index exists. the alert is set to real-time(need requires it to be real time). So cant work with increasing the schedule window.

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...