Examples
1. Put "download" events into an index named "download count"
eventtypetag="download" | collect index=downloadcount
2. Collect statistics on VPN connects and disconnects
You want to collect hourly statistics on VPN connects and disconnects by country.
The addinfo command ensures that the search results contain fields that specify when the search was run to populate these particular index values.
3. Ingest fields using the collect command and HEC formatted output
Say you want to create a few fields in your index by running the following search:
The results look something like this:
| _raw | _time | host | sentinel | source | sourcetype |
|---|---|---|---|---|---|
| this is an event with a key=value pair | 2024-01-12T19:22:55.000-08:00 | myhost | 4 | mysource | mysourcetype |
To see what the event we've just generated looks like in the index, run the following search:
index=main
The following image shows that all of the fields that were specified in the search appear as fields in the index.
Note that this search counts against your license usage because the search assigned a value to the source type and didn't use the default stash_hec sourcetype.