PHPackages                             perspectiveteam/module-smartlog - 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. perspectiveteam/module-smartlog

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

perspectiveteam/module-smartlog
===============================

AI-powered Magento 2 log analysis with semantic &amp; keyword search. Uses LLPhant + OpenSearch for embeddings and vector storage. Supports OpenAI, Google Gemini, and Voyage AI providers.

1.1.1(3mo ago)010↓87.3%MITPHPPHP &gt;=8.1

Since Mar 30Pushed 3mo agoCompare

[ Source](https://github.com/PerspectiveTeam/module-smartlog)[ Packagist](https://packagist.org/packages/perspectiveteam/module-smartlog)[ RSS](/packages/perspectiveteam-module-smartlog/feed)WikiDiscussions master Synced 4w ago

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

SmartLog — AI-Powered Log Analysis for Magento 2
================================================

[](#smartlog--ai-powered-log-analysis-for-magento-2)

Semantic &amp; keyword search across `var/log/**` and `var/report/**` using LLPhant embeddings + OpenSearch vector storage.

Features
--------

[](#features)

- **Hybrid search** — keyword (exact IDs, error codes) + semantic (natural language queries)
- **Multiple AI providers** — OpenAI, Google Gemini, Voyage AI
- **Admin UI** — search page at System &gt; SmartLog
- **CLI** — `bin/magento smartlog:index` with progress bar
- **Recursive log scanning** — reads all `var/log/**/*.log` and `var/report/**/*`
- **Isolated dependencies** — LLPhant runs in a separate PHP process to avoid PSR/autoloading conflicts with Magento 2

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

[](#requirements)

- Magento 2.4.x (Commerce or Open Source)
- PHP 8.1+
- OpenSearch (uses Magento's native catalog/search connection)
- API key for one of: OpenAI, Google Gemini, or Voyage AI

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

[](#installation)

### Via Composer (recommended)

[](#via-composer-recommended)

```
composer require perspectiveteam/module-smartlog
bin/magento module:enable Perspective_SmartLog
bin/magento setup:upgrade
bin/magento setup:di:compile
```

Worker dependencies are installed **automatically** during `setup:upgrade` via `Setup/Recurring.php`, which runs on **every** `setup:upgrade` — including pipeline deploys that rebuild the filesystem from scratch. If automatic installation fails (e.g. Composer not available in the execution context), run manually:

```
bin/magento smartlog:install-worker
```

### Manual (app/code)

[](#manual-appcode)

1. Copy the module to `app/code/Perspective/SmartLog/`
2. Enable the module and run setup — worker installs automatically: ```
    bin/magento module:enable Perspective_SmartLog
    bin/magento setup:upgrade
    bin/magento setup:di:compile
    ```
3. If automatic worker install failed: ```
    bin/magento smartlog:install-worker
    ```

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

[](#configuration)

Go to **Stores &gt; Configuration &gt; Perspective &gt; SmartLog**:

SettingDescriptionEnableEnable/disable the moduleEmbedding ProviderOpenAI / Google Gemini / Anthropic (Voyage AI)API KeyYour provider API keyModelEmbedding model (per provider)Chunk SizeNumber of log entries per chunk (default: 15)Batch SizeChunks per embedding API call (default: 20)OpenSearch IndexIndex name for vectors (default: `smartlog_vectors`)OpenSearch connection settings are read from Magento's native **Catalog &gt; Search** configuration.Usage
-----

[](#usage)

### CLI Indexing

[](#cli-indexing)

```
# Index all logs (respects enabled/disabled setting)
bin/magento smartlog:index
# Force index even if disabled
bin/magento smartlog:index --force
```

### Admin Search

[](#admin-search)

Navigate to **System &gt; SmartLog** — search with:

- Natural language: *"was there a shipping address problem recently?"*
- Exact values: *"40915"* (order ID), *"SQLSTATE"* (error code)
- Date filtering available

Architecture
------------

[](#architecture)

```
Perspective/SmartLog/
├── Block/Adminhtml/          # Admin UI block
├── Composer/                 # Composer post-install script (WorkerInstaller)
├── Console/Command/          # CLI commands (smartlog:index, smartlog:install-worker)
├── Controller/Adminhtml/     # Admin controllers (search, reindex)
├── Model/
│   ├── Config.php            # System configuration reader
│   ├── Config/Source/        # Admin dropdown source models
│   ├── Indexer.php           # Orchestrates log reading + worker calls
│   ├── LogReader.php         # Recursive log file reader + chunker
│   ├── SearchService.php     # Search orchestration + date filtering
│   └── WorkerBridge.php      # proc_open bridge to worker.php
├── Setup/
│   └── Recurring.php         # Auto-installs worker on every setup:upgrade
├── Worker/
│   ├── composer.json         # Isolated LLPhant + OpenSearch deps
│   ├── install.sh            # Dependency installer (fallback)
│   └── worker.php            # Standalone process (embeddings + vector ops)
├── etc/                      # Magento XML configs
└── view/adminhtml/           # Admin layout, templates, CSS

```

### Why a separate worker process?

[](#why-a-separate-worker-process)

LLPhant requires `psr/log` v3 and `psr/http-message` v2, which conflict with Magento 2's v1 copies. Instead of fighting autoloader isolation, the module runs LLPhant in a completely separate PHP process (`Worker/worker.php`), communicating via JSON over stdin/stdout.

### Worker installation flow

[](#worker-installation-flow)

1. **Primary** — `bin/magento setup:upgrade` triggers `Setup/Recurring.php` (runs on **every** upgrade) → `WorkerInstaller::install()` copies worker files to `/lib/smartlog/` and runs `composer install`. Works correctly after every pipeline deploy, even if `lib/smartlog/` was wiped.
2. **Fallback** — if the recurring step fails (e.g. no Composer in path), a warning is logged and you can finish manually: `bin/magento smartlog:install-worker`.

License
-------

[](#license)

MIT License. See [LICENSE.md](LICENSE.md) for details.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance82

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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 ~0 days

Total

3

Last Release

92d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2224d0304a0a24c0400cc456bb0b938202e0b049f290994445b34925e1f4ccb6?d=identicon)[monteshot](/maintainers/monteshot)

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

---

Top Contributors

[![monteshot](https://avatars.githubusercontent.com/u/2836146?v=4)](https://github.com/monteshot "monteshot (6 commits)")

### Embed Badge

![Health badge](/badges/perspectiveteam-module-smartlog/health.svg)

```
[![Health](https://phpackages.com/badges/perspectiveteam-module-smartlog/health.svg)](https://phpackages.com/packages/perspectiveteam-module-smartlog)
```

###  Alternatives

[mollie/magento2

Mollie Payment Module for Magento 2

1121.8M12](/packages/mollie-magento2)[fastly/magento2

Fastly CDN Module for Magento 2.4.x

1564.4M1](/packages/fastly-magento2)[run-as-root/magento2-prometheus-exporter

Magento2 Prometheus Exporter

68353.9k](/packages/run-as-root-magento2-prometheus-exporter)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1010.0k22](/packages/loki-magento2-components)[baldwin/magento2-module-url-data-integrity-checker

Magento 2 module which can find potential url related problems in your catalog data

282806.2k](/packages/baldwin-magento2-module-url-data-integrity-checker)[fredden/magento2-module-javascript-error-reporting

A Magento 2 module which captures JavaScript errors for later review by website administrators

3139.3k](/packages/fredden-magento2-module-javascript-error-reporting)

PHPackages © 2026

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