Skip to main content

log2http

log2http watches log files and sends new contents to a specified http endpoint. That's it.

Install

You will need Python >= 3.6.

Install the application like this (preferably in a virtualenv):

pip install log2http

Setup

Place a YAML config file like the following at a location of your preference:

-
  logfile: /Users/demo/example.log
  endpoint: http://endpoint1.example.com/tag/sample
  min_lines: 5
-
  logfile: /var/log/system.log
  endpoint: http://endpoint2.example.com/tag/syslog
  min_lines: 2
  • logfile specifies the file to watch
  • endpoint is the http endpoint you want to send the collected log lines to (as POST). Usually, this will be the url of a logging service, e.g. http://logs-01.loggly.com/bulk/token/tag/example/
  • min_lines sets the minimum of lines that must be collected until a http request is made (use this to minimize http overhead per logged event)

Usage

Once installed, you can launch log2http from your terminal:

log2http --config=/path/to/the/config.yml

When log2http is running, create some sample events to see if they are being collected. For example in bash:

for i in {1..6}; do echo "hello world" >> example.log; done

The output should tell you if events are being collected and sent.

You could also start the log collector from Python like this:

from log2http import load_config, LogCollector

config = load_config('/your/path/to/config.yml')
collector = LogCollector(config)
with collector:
    collector.start() # will run until interrupted

Watch out: log lines always need to end with a newline character (\n). If a line does not end with a newline character, log2http will wait indefinitely until it is written to the file.

Local development

See requirements-dev.txt for development requirements.

Run tests with pytest.

Run static type checking with mypy --ignore-missing-imports log2http.

Metadata

Release files for log2http 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for log2http 0.1.1
File Size Uploaded Provenance Actions
log2http-0.1.1.tar.gz 4.6 kB Without provenance Details for log2http-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for log2http 0.1.1
File Interpreter ABI Platform Actions
log2http-0.1.1-py3-none-any.whl Python 3 none any Details for log2http-0.1.1-py3-none-any.whl

Total release size: 9.9 kB

Release files / log2http-0.1.1.tar.gz

Download URL log2http-0.1.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7fdf3072c085d1cbd17d09ef13fadfe485656d23ff3a4228c45f8ccdf6e5017a
BLAKE2b-256 checksum
How to use checksums
82cdbce21a319c0b0d2e11bd4020ca2b2e7ed5ab2ab6549454adb4839488622e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Release files / log2http-0.1.1-py3-none-any.whl

Download URL log2http-0.1.1-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e3e3dd704fe94ff3395c8676b403e8c9aea6326bf85e5145484b9444d103020
BLAKE2b-256 checksum
How to use checksums
c0fcaa7793857ad202ddde50b28d7fcd0c5f2d4de619e1cd90201538306d38d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Security for log2http 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page