Total Cribl noob. I've been asked to use Cribl to download a file at regular intervals, but I can't see how that is done. The source is not anything in our environment - it's an external entity. If I were to do it manually in a scheduled python job, it would look like this.
oldest = (datetime.utcnow() - timedelta(hours=2)).strftime("%Y%m%d%H")
file_name = f"{oldest}.tar.bz2"
link = f"https://site.com/feeds/files/hourly/{oldest}"
r = requests.get(link, headers={"x-apikey": apikey})
file = BytesIO(r.content)
I've been asked to download the file with Cribl, send it to s3, then extract it and ingest the contents into elastic. The thought is they expect more data sources in the future as I would probably consider it overkill, but I said I would give it a try and see. But not sure if it does that sort of thing. Thanks for any advice you can offer.
Download file
Best answer by Brendan Dalpe
Hi @Jeff G, I think the REST Collector can accomplish this use case.
For the URL, you can use JavaScript to format the required timestamp. An example configuration for the Collect URL:
`https://site.com/files/hourly/${C.Time.strftime(earliest || (new Date().getTime() / 1000) - (60 * 60 * 2), "%Y%m%d%H")}`(Note: the backticks are important to copy!)

Since the contents are bzip2 compressed, you'll need to use the custom command to pass the contents to the bunzip2 command to get the decompressed contents.

I don't know what your data looks like, so you'll need to build an appropriate pipeline to process the data for the destination. You can configure this under the Result Routing tab on the left. You'll also need to configure your ElasticSearch destination.
To run everything on a schedule, click the Schedule button on the collector configuration. You can change the earliest time parameter to your liking (note that the variable is found in the URL)

Remember to Commit & Deploy your changes before trying to feed data to the destination!
Let us know how it goes!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
