I'm trying to figure out why you would use the various methods for sending search results to an index. Note, I'm not trying to speed up searches, I'm just looking at methods for writing search results to an index.
Effectively, I think they all do the same thing. Option 1 seems like a sneaky way around license usage. However, I think "collect" can only be used with summary indexes. Any thoughts on this?
There is another way to write to an index (as @richgalloway says there is no difference between a normal index or a summary index, it's just a notional idea that a summary index will typically contain events that are summarising other data).
If you have a scheduled saved search, you can enable 'Summary Indexing' from the Edit Summary Indexing option in the Searches Reports and Alerts view for that saved search.
https://community.splunk.com/t5/Splunk-Search/How-to-create-summary-index/m-p/632465
This is effectively the same as using collect.
Note when using collect, the documentation is unclear and wrong about the various aspects of how time gets defined in the collected event.
I have previously posted this information about collect and time
-----------------------------------------------------------------------------------------------
* _time field is NEVER passed if no _raw field is present. * Using addinfo=t will always PREPEND the fields to the summary row, this destroying the ability to define _time * Scheduled saved searches will always PREPEND the search_* fields, again destroying the ability to define _time
| eval _raw=printf("_time=%d", desired_time_field)
| fields - desired_time_field
| foreach *
[| eval _raw=_raw.", <<FIELD>>=\"".if(isnull('<<FIELD>>'),"",'<<FIELD>>')."\"")
| fields - "<<FIELD>>" ]
| collect index=bla source="bla" addtime=f testmode=f
There is another way to write to an index (as @richgalloway says there is no difference between a normal index or a summary index, it's just a notional idea that a summary index will typically contain events that are summarising other data).
If you have a scheduled saved search, you can enable 'Summary Indexing' from the Edit Summary Indexing option in the Searches Reports and Alerts view for that saved search.
https://community.splunk.com/t5/Splunk-Search/How-to-create-summary-index/m-p/632465
This is effectively the same as using collect.
Note when using collect, the documentation is unclear and wrong about the various aspects of how time gets defined in the collected event.
I have previously posted this information about collect and time
-----------------------------------------------------------------------------------------------
* _time field is NEVER passed if no _raw field is present. * Using addinfo=t will always PREPEND the fields to the summary row, this destroying the ability to define _time * Scheduled saved searches will always PREPEND the search_* fields, again destroying the ability to define _time
| eval _raw=printf("_time=%d", desired_time_field)
| fields - desired_time_field
| foreach *
[| eval _raw=_raw.", <<FIELD>>=\"".if(isnull('<<FIELD>>'),"",'<<FIELD>>')."\"")
| fields - "<<FIELD>>" ]
| collect index=bla source="bla" addtime=f testmode=f
@bowesmanathank you so much. This was extremely helpful. We created a similar macro using your foreach logic. Thank you again!
The first two are nearly equivalent with the only difference being whether or not ingestion license is charged. There is nothing "supposed" about the stash sourcetype not incurring license usage. It's documented at https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Collect#Syntax:~:text=By%20specif....
Unlike collect, the sendalert command does not write to an index. As the command name implies, it sends an alert. While it may be possible, I've never encountered an alert that writes to an index.
FTR, the collect command can write to any event index to which you have access. It does not have to be a summary index. Technically, all event indexes are the same, whether summary or not.
Thank you, @richgalloway. That is good to know that the collect command can write to any event index; it does not have to be a summary index.
The sendalert command invokes an alert action. I'm using it to invoke logevent, which would effectively leverage the Log event alert action.