Skip to main content

Aggregates and anonymize data distribution logs from seiscomp, ready to be sent to the central EIDA KPI service.

Project description

EIDA Statistics aggregation

[Coverage Status]

This project provides unified statistics about EIDA nodes usage.

This program is part of the EIDA statistics system. The aggregator groups a set of dataselect usage information in order to build a logging statistic ready to be shipped to the central system.

Aggregating data

Each EIDA node prepares an aggregation of their logging file using the same script.

This aggregation result is sent to a central database through a webservice provided by a central node

Install and execute

This program is intended for python3.6 and more.

From Pypi, using UV (recommended): uv tool install eida-statistics-aggregator eida_stats_aggregator --help

Alternatively, if you want to install with pip , run

pip install eida-statistics-aggregator 
eida_stats_aggregator --help

For now, the log file from seiscomp is expected to be a list of JSON entries compressed with BZIP2.

Exemples

Aggregate one bz2 seiscomp logfile:

eida_stats_aggregator --output-directory aggregates fdsnws-requests.log.2020-11-02.bz2

Also available with stdin:

cat fdsnws-requests.log.2020-11-02.bz2 |  eida_stats_aggregator --output-directory

You can also agregate several logfiles:

 eida_stats_aggregator --output-directory aggregates fdsnws-requests.log.2020-11-02.bz2  fdsnws-requests.log.2020-11-03.bz2

Registering the aggregation to the central statistics service

In order to register, you first need a token. Please ask for one by submitting an issue in https://github.com/eida/etc/issues/

When you have a valid token, you can send all your aggregation files with curl :

gunzip -c aggregationfile.json.gz | curl  --header "Authentication: Bearer MYSECRETTOKEN"  --header "Content-Type: application/json" -d "@-"  https://ws.resif.fr/eidaws/statistics/1/dataselectstats

The aggregation script can do this for you on the fly :

eida_stats_aggregator -o aggregates fdsn-requests.log.2020-11-02.bz2 --token MYSECRETTOKEN --send-to https://ws.resif.fr/eidaws/statistics/1/dataselectstats

Test

From the projet's root directory run

pipenv install
pipenv shell
python -m pytest tests/test_aggregator.py -s 

Aggregation problems

The Count distinct problem

Some information requested by EIDA need to count distint occurences of information (an IP, a country). A naive approach counting distinct occurences on each day and each node can't be used to count the distinct occurences at a global scale nor for another timewindow.

Enters HyperLogLog, an algorithm allowing to estimate occurences for different timeframe. hll is implemented in Python and PostgreSQL this is why this project uses both technologies.

Anonimization

We want to anonimize every data that can link to a person. This is why IP adresses are hashed using the same algorithm on each datacenter, in order to have consistant statistics.

Ingesting data

A webservice receiving POST request and ingesting the result in a database

Creating reports

This code create automatic reports from the database

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

eida_statistics_aggregator-0.8.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eida_statistics_aggregator-0.8.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file eida_statistics_aggregator-0.8.0.tar.gz.

File metadata

  • Download URL: eida_statistics_aggregator-0.8.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for eida_statistics_aggregator-0.8.0.tar.gz
Algorithm Hash digest
SHA256 0d829282298a976b4029d08a283e20f5f60f739929e60e8257e094d387564f83
MD5 5bbb3f03f1de750a37e6ea34bf81fd44
BLAKE2b-256 10508af0bbac4954ccc349ce1db58203602933b26fabbab3c361dfca935afcfb

See more details on using hashes here.

File details

Details for the file eida_statistics_aggregator-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: eida_statistics_aggregator-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for eida_statistics_aggregator-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8334163df2d3fc3689eb513f57968fe9394a1eefdf63d8cc8c2c606409d3f304
MD5 d73d11d1daec4cef0f1281035f6c37fa
BLAKE2b-256 bb87c9b099c60b751ea297caa6cd173d7588f75cbbddec34c6992228ff1a93c0

See more details on using hashes here.

Supported by

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