Skip to main content

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

Project description

AdGuard Home Log Sync

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

Description

AdGuard Home Log Sync 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.0.tar.gz (5.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.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for adguardhome_logsync-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c4919720e0e1180da7730150db1836eaa0f8eeddfa6cbfc7b9d05dfd3339dfb
MD5 89f01b49fa789fd907e050fb91e1406a
BLAKE2b-256 dbaf58ddc4ab60df8042473643ba81f3010425827502200b8c50f103f10a4d6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adguardhome_logsync-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51a2c78ad70522dfb50c29832d376f89f5340dc9a8580dd2cd6560204eaaff04
MD5 4a13703ea317a0da963fbee8d8ec5f31
BLAKE2b-256 3fff90458d3f2b8359ae4fa17bd5dd4628270bcff46202f9abb82dd28185f975

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