Tag Archives: template

Create a Random Bit Set with Jinja

Once in a while, when working with Jinja templating engine, you might need to create a random Bit Set with Jinja. Some might also call it a Binary Flag Set.

Basically, this will be a binary number (for example 10110) where each digit (bit) represents whether something is on/enabled/present or off.

In some systems, this binary number is actually stored as a base 10 integer. So 10110 will be stored as 22.

Continue reading Create a Random Bit Set with Jinja

Splunk Eventgen Jinja templating

I’ve recently dipped my toes into Splunk Eventgen (Jinja templating). It’s an awesome app that allows you to generate sample events that can be ingested by Splunk (or for any other reason).

EventGen has two ways of configuring the event content generation:

  • Traditional – where you specify a sample file and provide regexes that will be used to replace static content in the sample file with the required values
  • Jinja Templating – where you use Jinja templating engine to create the events.

While the traditional way is quite straightforward, the event’s format that I was after had a few nuances that made it not suitable for me, thus I had to fiddle with Splunk Eventgen Jinja templating.

Continue reading Splunk Eventgen Jinja templating