[![Build Status](https://www.travis-ci.org/chaturv3di/absynthe.svg?branch=master)](https://www.travis-ci.org/chaturv3di/absynthe)

# Absynthe: A (branching) Behavior Synthesizer

## Motivation

You need Absynthe if you wish to simulate the behavior of any well defined 
process -- whether it's a computer application or a business process flow. This
package helps in generating such behaviors in the form of logs, primarily to
aid testing and development of analytic techniques for log analysis and anomaly
detection. 

Multiple business processes or computer applications could be dumping their
logs into a single log stream in an interleaving manner. This means that
consecutive log lines could have originated in different, unrelated application
components. Absynthe is able to simulate such situations.

## Overview

Each business process or compuater application is modelled as a _control flow
graph_ (or _CFG_), which typically has one or more roots (i.e. entry) nodes and
multiple leaf (i.e. end) nodes. An example of a CFG generated using Absynthe is
shown below.

<img src="imgs/02_exampleCFG.png" width="1000" align="middle" />

Each _behavior_ is the sequence of nodes encountered while traversing this CFG 
from a root to a leaf. Of course, a CFG might contain loops which could be
traversed multiple times before arriving at the leaf. Moreover, if there are
multiple CFGs, then Absynthe can synthesize _interleaved_ behaviors. This means
that a single sequence of nodes might contain nodes from multiple CFGs. We are 
ultimately interested in this interleaving behavior, which is produced by
multiple CFGs.

<img src="imgs/01_exampleBehavior.png" width="750" align="middle" />

The above screenshot shows logs generated by Absynthe. Each log line starts
with a time stamp, followed by a session ID, CFG ID, and a log message. At
present, the log message is simply a random concatenation of the node ID to
which the log message corresponds. A single CFG might participate in multiple
sessions, where each session is a different traversal of the CFG. Therefore, we
maintain both session ID and CFG ID in the log line.

## Usage

The easiest way to use Absynthe is to `pip install absynthe` and then refer to
the method `basicLogGeneration` in the first example file in `examples` folder
in this repository.
