Skip to main content

Logprep allows to collect, process and forward log messages from various data sources.

Project description

Logprep

GitHub release (latest by date) GitHub Workflow Status (branch) Documentation Status GitHub contributors Coverage GitHub Repo stars

Introduction

Logprep allows to collect, process and forward log messages from various data sources. Log messages are being read and written by so-called connectors. Currently, connectors for Kafka, Opensearch, S3, HTTP and JSON(L) files exist.

The log messages are processed in serial by a pipeline of processors, where each processor modifies an event that is being passed through. The main idea is that each processor performs a simple task that is easy to carry out. Once the log message is passed through all processors in the pipeline the resulting message is sent to a configured output connector.

Logprep is primarily designed to process log messages. Generally, Logprep can handle JSON messages, allowing further applications besides log handling.

About Logprep

Pipelines

Logprep processes incoming log messages with a configured pipeline that can be spawned multiple times via multiprocessing. The following chart shows a basic setup that represents this behaviour. The pipeline consists of three processors: the Dissector, Geo-IP Enricher and the Dropper. Each pipeline runs concurrently and takes one event from it's Input Connector. Once the log messages is fully processed the result will be forwarded to the Output Connector, after which the pipeline will take the next message, repeating the processing cycle.

flowchart LR
A1[Input\nConnector] --> B
A2[Input\nConnector] --> C
A3[Input\nConnector] --> D
subgraph Pipeline 1
B[Dissector] --> E[Geo-IP Enricher]
E --> F[Dropper]
end
subgraph Pipeline 2
C[Dissector] --> G[Geo-IP Enricher]
G --> H[Dropper]
end
subgraph Pipeline n
D[Dissector] --> I[Geo-IP Enricher]
I --> J[Dropper]
end
F --> K1[Output\nConnector]
H --> K2[Output\nConnector]
J --> K3[Output\nConnector]

Processors

Every processor has one simple task to fulfill. For example, the Dissector can split up long message fields into multiple subfields to facilitate structural normalization. The Geo-IP Enricher, for example, takes an ip-address and adds the geolocation of it to the log message, based on a configured geo-ip database. Or the Dropper deletes fields from the log message.

As detailed overview of all processors can be found in the processor documentation.

To influence the behaviour of those processors, each can be configured with a set of rules. These rules define two things. Firstly, they specify when the processor should process a log message and secondly they specify how to process the message. For example which fields should be deleted or to which IP-address the geolocation should be retrieved.

Connectors

Connectors are responsible for reading the input and writing the result to a desired output. The main connectors that are currently used and implemented are a kafka-input-connector and a kafka-output-connector allowing to receive messages from a kafka-topic and write messages into a kafka-topic. Addionally, you can use the Opensearch or Opensearch output connectors to ship the messages directly to Opensearch or Opensearch after processing.

The details regarding the connectors can be found in the input connector documentation and output connector documentation.

Configuration

To run Logprep, certain configurations have to be provided. Because Logprep is designed to run in a containerized environment like Kubernetes, these configurations can be provided via the filesystem or http. By providing the configuration via http, it is possible to control the configuration change via a flexible http api. This enables Logprep to quickly adapt to changes in your environment.

First, a general configuration is given that describes the pipeline and the connectors, and lastly, the processors need rules in order to process messages correctly.

The following yaml configuration shows an example configuration for the pipeline shown in the graph above:

process_count: 3
timeout: 0.1

pipeline:
  - dissector:
      type: dissector
      rules:
        - https://your-api/dissector/
        - rules/01_dissector/rules/
  - geoip_enricher:
      type: geoip_enricher
      rules:
        - https://your-api/geoip/
        - rules/02_geoip_enricher/rules/
      tree_config: artifacts/tree_config.json
      db_path: artifacts/GeoDB.mmdb
  - dropper:
      type: dropper
      rules:
        - rules/03_dropper/rules/

input:
  mykafka:
    type: confluentkafka_input
    bootstrapservers: [127.0.0.1:9092]
    topic: consumer
    group: cgroup
    auto_commit: true
    session_timeout: 6000
    offset_reset_policy: smallest
output:
  opensearch:
    type: opensearch_output
    hosts:
        - 127.0.0.1:9200
    default_index: default_index
    error_index: error_index
    message_backlog_size: 10000
    timeout: 10000
    max_retries:
    user: the username
    secret: the passord
    cert: /path/to/cert.crt

The following yaml represents a dropper rule which according to the previous configuration should be in the rules/03_dropper/rules/ directory.

filter: "message"
drop:
  - message
description: "Drops the message field"

The condition of this rule would check if the field message exists in the log. If it does exist then the dropper would delete this field from the log message.

Details about the rule language and how to write rules for the processors can be found in the rule configuration documentation.

Documentation

The documentation for Logprep is online at https://logprep.readthedocs.io/en/latest/ or it can be built locally via:

sudo apt install pandoc
uv sync --frozen --extra doc
cd ./doc/
make html

A HTML documentation can be then found in doc/_build/html/index.html.

Container signatures

From release 15 on, Logprep containers are signed using the cosign tool. To verify the container, you can copy the following public key into a file logprep.pub:

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgkQXDi/N4TDFE2Ao0pulOFfbGm5g
kVtARE+LJfSFI25BanOG9jaxxRGVt+Sa1KtQbMcy7Glxu0s7XgD9VFGjTA==
-----END PUBLIC KEY-----

And use it to verify the signature:

cosign verify --key logprep.pub ghcr.io/fkie-cad/logprep:py3.11-latest

The output should look like:

Verification for ghcr.io/fkie-cad/logprep:py3.11-latest --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - Existence of the claims in the transparency log was verified offline
  - The signatures were verified against the specified public key

[{"critical":{"identity":{"docker-reference":"ghcr.io/fkie-cad/logprep"}, ...

Container SBOM

From release 15 on, Logprep container images are shipped with a generated sbom. To verify the attestation and extract the SBOM use cosign with:

cosign verify-attestation --key logprep.pub ghcr.io/fkie-cad/logprep:py3.11-latest | jq '.payload | @base64d | fromjson | .predicate | .Data | fromjson' > sbom.json

The output should look like:

Verification for ghcr.io/fkie-cad/logprep:py3.11-latest --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - Existence of the claims in the transparency log was verified offline
  - The signatures were verified against the specified public key

Finally, you can view the extracted sbom with:

cat sbom.json | jq

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

logprep-18.1.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distributions

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

logprep-18.1.0-cp314-cp314-musllinux_1_2_x86_64.whl (908.0 kB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

logprep-18.1.0-cp314-cp314-manylinux_2_28_x86_64.whl (834.8 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

logprep-18.1.0-cp313-cp313-musllinux_1_2_x86_64.whl (908.2 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

logprep-18.1.0-cp313-cp313-manylinux_2_28_x86_64.whl (835.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

logprep-18.1.0-cp312-cp312-musllinux_1_2_x86_64.whl (908.1 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

logprep-18.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (835.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

logprep-18.1.0-cp311-cp311-musllinux_1_2_x86_64.whl (909.7 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

logprep-18.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (837.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

File details

Details for the file logprep-18.1.0.tar.gz.

File metadata

  • Download URL: logprep-18.1.0.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for logprep-18.1.0.tar.gz
Algorithm Hash digest
SHA256 177e0f0f8a68a12732a1f4c06855d582ee54ef531b991e53ba37d67d34b78088
MD5 439e2b28e952cfa28751ce17f2d524fb
BLAKE2b-256 a7baf34aa0e7ce6229405bc291a52c6afe107f1a804386a7515cd488e9bfd976

See more details on using hashes here.

Provenance

The following attestation bundles were made for logprep-18.1.0.tar.gz:

Publisher: publish-release-to-pypi.yml on fkie-cad/Logprep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logprep-18.1.0-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for logprep-18.1.0-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4300aa9874c756bb7c3c065961dfb2029665ba529d5411b09bf101246888ec7c
MD5 2bdc0d635621b6c675e497e449bbc635
BLAKE2b-256 89ca6a2baf91c3aeed7e2743eb90e538eec66d6b2b656225fb5ddc0097e60183

See more details on using hashes here.

Provenance

The following attestation bundles were made for logprep-18.1.0-cp314-cp314-musllinux_1_2_x86_64.whl:

Publisher: publish-release-to-pypi.yml on fkie-cad/Logprep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logprep-18.1.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for logprep-18.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cfd92cfa4f7acad6f4fc098dbcac539a3d2731f582c30bed4d5c325f54ee17f8
MD5 778fe69b982e5eb777cf417c6e965c72
BLAKE2b-256 44fc00590f92756977ca24db3562021fb76ba740d13fbb32eb106ac6a5051154

See more details on using hashes here.

Provenance

The following attestation bundles were made for logprep-18.1.0-cp314-cp314-manylinux_2_28_x86_64.whl:

Publisher: publish-release-to-pypi.yml on fkie-cad/Logprep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logprep-18.1.0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for logprep-18.1.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 03487683ae7007473ddf59ef873bc037f6ba0582ff622949721324d5338210af
MD5 3505f258a658d5184ae24915e91594f6
BLAKE2b-256 f2d8d8bd3b0c80fe10e65714f623f6f1c293f65993d680eb7a47869ac2ca3ba4

See more details on using hashes here.

Provenance

The following attestation bundles were made for logprep-18.1.0-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: publish-release-to-pypi.yml on fkie-cad/Logprep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logprep-18.1.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for logprep-18.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7a9d38df71bd055352cd131e6e4a11668fef9ebc71dde93ef41875a792b4fe09
MD5 d91494382276eefe8fd34222410515cf
BLAKE2b-256 917dd378dbfde853e51305ffbe7ecb20d5afcfc627bdb9a2694a0e3391dc1963

See more details on using hashes here.

Provenance

The following attestation bundles were made for logprep-18.1.0-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: publish-release-to-pypi.yml on fkie-cad/Logprep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logprep-18.1.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for logprep-18.1.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0c48f14ebb1fc92dce2ad2e534dd4532f1c3de802895524119e49dbe784702cd
MD5 f68da6c8c6ca07d7d45aca4efa08fb30
BLAKE2b-256 9f3fc9b2889ab68842e58ebdcb29a0be02c4f146d434d6133b230581d25f0e14

See more details on using hashes here.

Provenance

The following attestation bundles were made for logprep-18.1.0-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: publish-release-to-pypi.yml on fkie-cad/Logprep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logprep-18.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for logprep-18.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a6068828a84f9983f467f15526e7279f2a0fb646c92e998bbdb122d4b5f2679a
MD5 9a0f60edf5ec6b79071e78b6cc751201
BLAKE2b-256 e19ab0d7dc4c79a1991dc4cc03b0c19d8b3ce5961006fff336dabd3796f1c727

See more details on using hashes here.

Provenance

The following attestation bundles were made for logprep-18.1.0-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: publish-release-to-pypi.yml on fkie-cad/Logprep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logprep-18.1.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for logprep-18.1.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1b56b20f9e25af303edae00df46223a6cc905e18031cb1e7f0efa411fa98f799
MD5 f2f6797b36c8e4c702dfeb4cdacd43f2
BLAKE2b-256 838c56775f332972d77fd73df29588a1ba5239b33a11de582028628897c38529

See more details on using hashes here.

Provenance

The following attestation bundles were made for logprep-18.1.0-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: publish-release-to-pypi.yml on fkie-cad/Logprep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logprep-18.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for logprep-18.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e2b29408623e7a2a390e2aab003bda5b738962f166c0bb7c21734a218f991be1
MD5 e52eb8efe871679f085b26aff367456d
BLAKE2b-256 fea3f673967e8873c8afa92f75e11452764acccdbca679d8f2ca772926831698

See more details on using hashes here.

Provenance

The following attestation bundles were made for logprep-18.1.0-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: publish-release-to-pypi.yml on fkie-cad/Logprep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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