🎶Can't Stop, Addicted to the Search-ing🎶
Macros​
Has this ever happened to you? You're working on a query in Cribl Search, and you realize you need to use the same query in another search. You could copy and paste the query, but that's a pain. You could save the query as a search, but that's overkill. What if you could just save the query text and reuse it whenever you want? Well, now you can!
- Click
Stream
in the top left of the UI and in the resulting dropdown clickSearch
- In the top nav click
Settings
- On the left side of the screen, click
Macros
- Click
Add Macro
at the top right - Fill out the information as follows:
- ID:
export_logs
- Description:
Export logs to Cribl Lake
- Definition:
| export to lake default_logs
- ID:
- Click
Save
I guess we should talk about export
now, huh?
export
​
If you go through the Cribl Lake Overview Sandbox (shameless plug), we'll guide you through configuring Stream to recieve data from Search and then push it in to Lake. We'll also tell you why you would want to do that (hint: re-use the Route to send to multiple Destinations). However, we'll also guide you through the process of export
ing data from Search to Lake. There is a subtle difference between the two: send
can push to external destinations through use of Stream while export
pushes directly to Lake (no Streams attached).
Here we're just gonna show you how to export
, so if you want the more nuanced approach, check out the Cribl Lake Overview Sandbox (shameless plug x2).
- Click
Home
from the top nav - Under
Available Dataset
, hover overcribl_search_sample
and clickSearch Now
- At the end of the query, add
${export_logs}
Your query should look like this:dataset="cribl_search_sample" | limit 1000 ${export_logs}
- Click the blue
Search
at the top right of the query box - Once the search completes, change your query to the following:
dataset="default_logs" | limit 1000
- Click
Search
OK, let's take a second to unwind and discuss what just happened.
First, you created a macro. Said macro was a snippet of a query that just so happens to use export
. More specifically, it exports all query results to the default_logs
dataset in Cribl Lake (which you didn't have to do anything to configure, by the way). Then you used that macro in a search of the cribl_search_sample
dataset, thus exporting the logs. Finally, you queried the default_logs
dataset to see the logs you just exported (again without needing to configure Lake as a datasource). Wowzers. That was a lot.
By the way, we also have a great Cribl Search Overview Sandbox! And if you've done that, we have yet another Search Sandbox that covers connecting Search to various supported data sources (like Amazon S3 and generic APIs).