Skip to main content

A Python script designed to read output from pmacct daemons, to process it and to store it into ElasticSearch.

Project description

pmacct-to-elasticsearch

pmacct-to-elasticsearch is a python script designed to read output from pmacct daemons, to process it and to store it into ElasticSearch. It works with both memory and print plugins and, optionally, it can perform manipulations on data (such as to add fields on the basis of other values).

img/data_flow.png
  1. pmacct daemons collect IP accounting data and process them with their plugins;

  2. data are stored into in-memory-tables (memory plugins), JSON or CSV files (print plugins);

  3. crontab jobs (memory plugins) or trigger scripts (print plugins) are invoked to execute pmacct-to-elasticsearch;

  4. pmacct’s output records are finally processed by pmacct-to-elasticsearch, which reads them from stdin (memory plugins) or directly from file.

Optionally, some data transformations can be configured, to allow pmacct-to-elasticsearch to add or remove fields to/from the output documents that are sent to ElasticSearch for indexing. These additional fields may be useful to enhance graphs and reports legibility, or to add a further level of aggregation or filtering.

Installation

Install the program using pip:

pip install pmacct-to-elasticsearch

Then clone the repository and run the ./install script to setup your system:

cd /usr/local/src/
git clone https://github.com/pierky/pmacct-to-elasticsearch.git
cd pmacct-to-elasticsearch/
./install

Configuration

Please refer to the CONFIGURATION.md file. The TRANSFORMATIONS.md file contains details about data transformations configuration.

A simple tutorial on pmacct integration with ElasticSearch/Kibana using pmacct-to-elasticsearch can be found at http://blog.pierky.com/integration-of-pmacct-with-elasticsearch-and-kibana.

Future work

  • Add support of more pmacct output formats (Apache Avro, …).

Author

Pier Carlo Chiodi - https://pierky.com/

Blog: https://blog.pierky.com/ Twitter: @pierky

Changelog

0.3.2

  • Code linting and fixing import and pip3 errors.

    Thanks to @palisadoes (Peter Harrison) <https://github.com/palisadoes> for these fixes.

0.3.1

  • Fix: ES 6.2 compatibility.

    Issue #9 <https://github.com/pierky/pmacct-to-elasticsearch/issues/9>.

0.3.0

  • New: CSV output support.

    The InputFormat option in the plugin configuration file can be used to instruct pmacct-to-elasticsearch to parse CSV output from pmacct.

  • New: Multithreading support.

    The ReaderThreads option in the plugin configuration file sets the number of threads used to process pmacct’s output.

  • New: More command line arguments.

    The command line arguments under the Configuration options group can be used to override settings done on the plugin configuration file.

  • Fix issue with index creation on ElasticSearch 5.x.

    Thanks to Kristoffer Olsson and Daniel Lindberg for reporting this and for their extensive support.

  • Improved template for index creation.

  • Fix an issue with transformations.

0.2.0

  • New feature: HTTP Authentication support for ES API.

0.1.0

First release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pmacct-to-elasticsearch-0.3.2.tar.gz (12.5 kB view details)

Uploaded Source

File details

Details for the file pmacct-to-elasticsearch-0.3.2.tar.gz.

File metadata

  • Download URL: pmacct-to-elasticsearch-0.3.2.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.1 setuptools/3.3 requests-toolbelt/0.8.0 tqdm/4.14.0 CPython/3.4.3

File hashes

Hashes for pmacct-to-elasticsearch-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f24f83a0db1d7398c7262ccd3e124a10ce15f1d04b928bf14739adf0460c37c5
MD5 96f6330fae483c44f5ac0c22c71c71b9
BLAKE2b-256 b2580d1621f1896fc8fd4eb5c501763e3e14d1b04a21446e1017f45e7dd31ae9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page