Skip to main content

A Python tool to synchronize AdGuard Home query logs between multiple instances

Project description

AdGuardHome-LogSync

A Python tool to synchronize AdGuard Home query logs between multiple instances.

Description

AdGuardHome-LogSync allows you to merge and synchronize query logs from multiple AdGuard Home instances. This is useful when you're running multiple AdGuard Home instances and want to maintain a unified query log.

Features

  • Backup existing query logs
  • Merge multiple query log files
  • Safe atomic replacement of original logs
  • Command-line interface for easy automation

Installation

Using pipx (Recommended)

Install from PyPI:

pipx install adguardhome-logsync

Install from Git repository:

pipx install git+https://github.com/xz-dev/AdGuardHomeLogSync.git

Using pip

Install from PyPI:

pip install adguardhome-logsync

Install from Git repository:

pip install git+https://github.com/xz-dev/AdGuardHomeLogSync.git

Usage

adguardhome-logsync --name <instance-name> --path <querylog-path> --backup <backup-directory>

Parameters

  • --name: Current instance nickname (required)
  • --path: Path to the query log file (required)
  • --backup: Path to backup directory (required)

Example

adguardhome-logsync --name genx --path ~/adg/workdir/data/querylog.json --backup ~/adg/workdir/data/backup

Example Output

Starting log synchronization for instance: genx
Backing up querylog...
Searching for querylog files...
Found 3 querylog files
Merging querylogs...
Writing merged querylog...
Moving to updated querylog at /tmp/tmp2eqv7rdc.json...
Log synchronization completed successfully

Development

Prerequisites

  • Python 3.8+
  • uv (for development)

Running from Source

Clone the repository:

git clone https://github.com/xz-dev/AdGuardHomeLogSync.git
cd AdGuardHomeLogSync

Run with uv:

uv run main.py --name genx --path ~/adg/workdir/data/querylog.json --backup ~/adg/workdir/data/backup

Project Structure

AdGuardHomeLogSync/
├── main.py                 # Main entry point
├── utils/
│   ├── querylog_copy.py   # Backup and file operations
│   └── querylog_merge.py  # Log merging logic
├── pyproject.toml         # Project configuration
└── README.md             # This file

How It Works

  1. Backup: Creates a backup of the current query log with instance name
  2. Discovery: Searches for all query log files in the backup directory
  3. Merge: Combines all found query logs into a single unified log
  4. Replace: Safely replaces the original query log with the merged version

Requirements

  • AdGuard Home instances with JSON format query logs
  • Write access to query log files and backup directory
  • Python 3.8 or higher

License

BSD-3-Clause

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Issues

Please report issues at: https://github.com/xz-dev/AdGuardHomeLogSync/issues

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

adguardhome_logsync-0.1.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

adguardhome_logsync-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file adguardhome_logsync-0.1.1.tar.gz.

File metadata

  • Download URL: adguardhome_logsync-0.1.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for adguardhome_logsync-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d2e0e6fa8d390c6e9f1357ec197c25c16defcc64f970cd292a7811003aed2071
MD5 210657c623f92022c78541322ac1a929
BLAKE2b-256 2cb132ee44727ce93f404eb97eff9e6e61b5525d05968c83c92883f55221a60f

See more details on using hashes here.

File details

Details for the file adguardhome_logsync-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for adguardhome_logsync-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 156ea014b792accf31904113ade5288ebdb480b9f86fdd06a2be4be56f840671
MD5 e9ab3b1e356f36fdfa9b1c6e22b310d4
BLAKE2b-256 a382fcb1204ecccc440337f6d8b43f338e70c8bd71a75fbb219465a35b20788b

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