PHPackages                             hryvinskyi/magento2-api-logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. hryvinskyi/magento2-api-logger

ActiveMagento2-module[Logging &amp; Monitoring](/categories/logging)

hryvinskyi/magento2-api-logger
==============================

Enterprise API logging solution with granular endpoint control, secret sanitization, and advanced viewer

1.1.2(2mo ago)4151↓33.3%MITPHPPHP ^8.1

Since Nov 26Pushed 2mo agoCompare

[ Source](https://github.com/hryvinskyi/magento2-api-logger)[ Packagist](https://packagist.org/packages/hryvinskyi/magento2-api-logger)[ RSS](/packages/hryvinskyi-magento2-api-logger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (8)Used By (0)

Advanced API Logger for Adobe Commerce (Magento 2)
==================================================

[](#advanced-api-logger-for-adobe-commerce-magento-2)

Enterprise API logging solution for Magento 2 with granular endpoint control, secret sanitization, analytics dashboard, request replay, and an advanced log viewer.

[![Latest Stable Version](https://camo.githubusercontent.com/c32652a5c6cdf00872985dbb76191ae13a08dafdc6bd3024b5392a6c5c9c3a1c/68747470733a2f2f706f7365722e707567782e6f72672f68727976696e736b79692f6d6167656e746f322d6170692d6c6f676765722f762f737461626c65)](https://packagist.org/packages/hryvinskyi/magento2-api-logger)[![Total Downloads](https://camo.githubusercontent.com/7f46cec1e6f9f6ed00bacca1a0e883c255d57ce2a7287295a52ff951bb42e36d/68747470733a2f2f706f7365722e707567782e6f72672f68727976696e736b79692f6d6167656e746f322d6170692d6c6f676765722f646f776e6c6f616473)](https://packagist.org/packages/hryvinskyi/magento2-api-logger)[![PayPal donate button](https://camo.githubusercontent.com/0d6e4d8b50b5983a58205941b1a581b1305903393b7a39da574e3f60af3c7f5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617970616c2d646f6e6174652d79656c6c6f772e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=volodymyr%40hryvinskyi%2ecom&lc=UA&item_name=Magento%202%20Advanced%20API%20Logger&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted "Donate once-off to this project using Paypal")[![Latest Unstable Version](https://camo.githubusercontent.com/de22041617f57432210f29741c49f23518abfbf08987df2b35690e6ce2773126/68747470733a2f2f706f7365722e707567782e6f72672f68727976696e736b79692f6d6167656e746f322d6170692d6c6f676765722f762f756e737461626c65)](https://packagist.org/packages/hryvinskyi/magento2-api-logger)[![License](https://camo.githubusercontent.com/b446fceecf82a7c4f900974d7b069cd15eea9d46831468ea1c692d90a578516c/68747470733a2f2f706f7365722e707567782e6f72672f68727976696e736b79692f6d6167656e746f322d6170692d6c6f676765722f6c6963656e7365)](https://packagist.org/packages/hryvinskyi/magento2-api-logger)

Screenshots
-----------

[](#screenshots)

### Dashboard

[](#dashboard)

Real-time analytics with request volume charts, slowest endpoints, error rate, and summary cards. Supports 7 / 14 / 30 day period switching.

[![Dashboard](docs/dashboard.jpg)](docs/dashboard.jpg)

### Log Detail View

[](#log-detail-view)

Full request/response inspection with formatted JSON, syntax highlighting, performance metrics, query parameters, and quick actions.

[![Log View](docs/log_view.jpg)](docs/log_view.jpg)

### Compare &amp; Replay

[](#compare--replay)

Side-by-side comparison of two log entries and request replay for debugging.

[![Compare](docs/compare.jpg)](docs/compare.jpg)

Features
--------

[](#features)

- **Granular Endpoint Control** — whitelist specific REST API endpoints with pattern-based matching and per-endpoint HTTP method filtering
- **Selective Response Code Logging** — choose which HTTP status codes to capture (200, 400, 401, 404, 500, etc.)
- **Secret Sanitization** — automatic detection and hashing of sensitive fields (passwords, tokens, API keys, card numbers) with customizable field list
- **Analytics Dashboard** — request volume over time, top 10 slowest endpoints, error rate, exception count with 7/14/30 day period views
- **Advanced Log Viewer** — formatted JSON with syntax highlighting, query parameter extraction, content-type badges, body size display, and status code badges
- **Request Replay** — re-execute original API requests and compare response status, duration, and body against the original
- **Compare Mode** — side-by-side comparison of any two log entries with related endpoint search
- **Export** — download logs as HAR (HTTP Archive) or raw HTTP (RFC 7230) format
- **Performance Metrics** — per-endpoint statistics including avg/min/max duration, request count, and percentile rank
- **Automatic Cleanup** — cron-based retention policy with configurable period and batch deletion
- **Admin Grid** — sortable, filterable listing with mass delete, column bookmarks, and date range filters
- **Multi-Store Support** — store-scoped logging configuration with store name display in log viewer

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Magento 2.4.x (Open Source or Adobe Commerce)
- `hryvinskyi/magento2-base` module

Installation
------------

[](#installation)

### Via Composer (recommended)

[](#via-composer-recommended)

```
composer require hryvinskyi/magento2-api-logger
bin/magento module:enable Hryvinskyi_ApiLogger
bin/magento setup:upgrade
bin/magento cache:flush
```

### Manual Installation

[](#manual-installation)

1. Download the module from GitHub
2. Place it in `app/code/Hryvinskyi/ApiLogger`
3. Run:

```
bin/magento module:enable Hryvinskyi_ApiLogger
bin/magento setup:upgrade
bin/magento cache:flush
```

Configuration
-------------

[](#configuration)

Navigate to **Stores &gt; Configuration &gt; Hryvinskyi Extensions &gt; API Logger**

### General Settings

[](#general-settings)

OptionDescriptionDefaultEnable API LoggingMaster on/off switchDisabledEnabled EndpointsSelect which endpoints to log (grouped selector with search)AllEnabled Response CodesSelect specific HTTP response codes to logAllLog Request HeadersInclude HTTP request headers in logYesLog Request BodyInclude request payload in logYesLog Response HeadersInclude HTTP response headers in logYesLog Response BodyInclude response payload in logYes### Security &amp; Sanitization

[](#security--sanitization)

OptionDescriptionDefaultSanitize Sensitive DataAutomatic secret field detection and hashingEnabledSecret Field NamesComma-separated list of field patterns to treat as secretspassword, token, authorization, api\_key, secret, access\_token, refresh\_token, private\_key, client\_secret, card\_number, cvv, ssn### Cleanup &amp; Retention

[](#cleanup--retention)

OptionDescriptionDefaultEnable Automatic CleanupCron job to delete old logs (daily at 2:00 AM)EnabledRetention PeriodDays to keep logs before automatic deletion30Usage
-----

[](#usage)

### Dashboard

[](#dashboard-1)

Navigate to **System &gt; Tools &gt; API Logger &gt; Dashboard** to view analytics:

- **Summary Cards** — total requests, average duration, error rate, and exception count
- **Request Volume Chart** — line chart showing daily request count over the selected period
- **Slowest Endpoints Chart** — horizontal bar chart with the top 10 slowest endpoints by average duration (color-coded: green &lt; 100ms, yellow &lt; 500ms, orange &lt; 1000ms, red &gt;= 1000ms)
- **Period Selector** — switch between 7, 14, and 30 day views

### Viewing Logs

[](#viewing-logs)

Navigate to **System &gt; Tools &gt; API Logger &gt; Logs**:

1. Use grid filters to find specific logs by endpoint, method, response code, IP address, or date range
2. Click **View** on any entry to open the detail view
3. Detail view provides:
    - Formatted JSON request/response with syntax highlighting and search
    - Query parameters extracted from endpoint URL
    - Performance metrics (duration, percentile rank among similar endpoints)
    - Content-type and body size badges
    - Related log entries for the same endpoint

### Replay Requests

[](#replay-requests)

From the log detail view, click **Replay** to:

1. Re-execute the original API request with the same method, headers, and body
2. Compare original vs. replayed response status code and duration
3. Inspect the full replay response body

### Compare Entries

[](#compare-entries)

From the log detail view, click **Compare** to:

1. Search for related log entries by endpoint pattern
2. Select an entry for side-by-side comparison
3. Review differences in status codes, durations, headers, and response bodies

### Export Logs

[](#export-logs)

From the log detail view, use the export dropdown to download:

- **HAR Format** — standard HTTP Archive format compatible with browser dev tools and analysis tools
- **Raw HTTP** — plain text RFC 7230 format showing the full request and response

### Managing Logs

[](#managing-logs)

- **Delete Single** — delete button in grid row or detail view
- **Mass Delete** — select multiple entries in the grid and use the mass delete action
- **Automatic Cleanup** — configure retention period in settings; cron runs daily at 2:00 AM

ACL Resources
-------------

[](#acl-resources)

ResourceDescription`Hryvinskyi_ApiLogger::api_logger`Main module access`Hryvinskyi_ApiLogger::dashboard`View dashboard`Hryvinskyi_ApiLogger::logs`View and manage logs`Hryvinskyi_ApiLogger::replay`Replay API requests`Hryvinskyi_ApiLogger::delete`Delete log entries`Hryvinskyi_ApiLogger::config`Module configurationTechnical Details
-----------------

[](#technical-details)

### How It Works

[](#how-it-works)

The module uses a Magento plugin on `Magento\Webapi\Controller\Rest::dispatch` to intercept REST API requests and responses. The plugin:

1. Captures request data (endpoint, method, headers, body, IP, user agent) in `beforeDispatch`
2. Captures response data (status code, headers, body) and measures duration in `afterDispatch`
3. Matches the endpoint against configured whitelist patterns
4. Sanitizes sensitive fields if enabled
5. Persists the log entry to the `hryvinskyi_api_log_entry` database table

### Database Table

[](#database-table)

**Table:** `hryvinskyi_api_log_entry`

ColumnTypeDescriptionentity\_idINT (PK)Auto-increment primary keyendpointVARCHAR(512)API endpoint pathmethodVARCHAR(10)HTTP methodrequest\_headersMEDIUMTEXTJSON-encoded request headersrequest\_bodyMEDIUMTEXTRequest payloadresponse\_headersMEDIUMTEXTJSON-encoded response headersresponse\_bodyMEDIUMTEXTResponse payloadresponse\_codeSMALLINTHTTP response status codedurationDECIMAL(10,4)Request duration in millisecondsis\_exceptionBOOLEANWhether an exception occurredstore\_idINTAssociated store IDip\_addressVARCHAR(45)Client IP address (IPv4/IPv6)user\_agentVARCHAR(512)Client user agent stringcreated\_atTIMESTAMPEntry creation timestampIndexed columns: `endpoint`, `method`, `response_code`, `is_exception`, `created_at`, `store_id`

Author
------

[](#author)

**Volodymyr Hryvinskyi**

- Email:
- GitHub:

License
-------

[](#license)

This module is licensed under the [MIT License](LICENSE).

Support
-------

[](#support)

For issues, feature requests, or questions, please contact the author or submit an issue on GitHub.

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance90

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Recently: every ~21 days

Total

7

Last Release

80d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e254b6c28f67e639b2beb3f21a80f2b4ff9efc5ee782943d497b73523f630c1d?d=identicon)[hryvinskyi](/maintainers/hryvinskyi)

---

Top Contributors

[![hryvinskyi](https://avatars.githubusercontent.com/u/9294098?v=4)](https://github.com/hryvinskyi "hryvinskyi (9 commits)")

### Embed Badge

![Health badge](/badges/hryvinskyi-magento2-api-logger/health.svg)

```
[![Health](https://phpackages.com/badges/hryvinskyi-magento2-api-logger/health.svg)](https://phpackages.com/packages/hryvinskyi-magento2-api-logger)
```

###  Alternatives

[kiwicommerce/module-admin-activity

The Admin Activity extension makes it easy to track all admin activity and revert the modification.

102407.9k](/packages/kiwicommerce-module-admin-activity)[ghostunicorns/module-webapi-logs

Magento Webapi Log Details accessible via backend

67228.0k](/packages/ghostunicorns-module-webapi-logs)[catgento/module-admin-activity

The Admin Activity extension makes it easy to track all admin activity and revert the modification.

64102.6k](/packages/catgento-module-admin-activity)[corrivate/magento2-rest-api-logger

Advanced and convenient logging

2146.2k1](/packages/corrivate-magento2-rest-api-logger)[mage-os/module-admin-activity-log

The Admin Activity extension makes it easy to track all admin activity with comprehensive audit logging.

261.4k](/packages/mage-os-module-admin-activity-log)[graycore/magento2-stdlogging

A Magento 2 module that changes all logging handlers to stdout

2382.6k](/packages/graycore-magento2-stdlogging)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
