Skip to content

feat(services): add log and login/session services#982

Open
karlitschek wants to merge 4 commits into
masterfrom
split/05-services-logs-sessions
Open

feat(services): add log and login/session services#982
karlitschek wants to merge 4 commits into
masterfrom
split/05-services-logs-sessions

Conversation

@karlitschek
Copy link
Copy Markdown
Member

Adds four read-only service classes used by the upcoming admin dashboard cards. None are wired into existing controllers yet, so this change is a pure addition with no behavior change.

  • LogTailReader - last N WARN/ERROR entries from the JSON log
    (no shell, line-bounded)
  • LoginStats - bruteforce attempt counters and the top
    offending IPs over recent windows
  • ActivityRate - oc_activity row counts over the last hour /
    day / week
  • ActiveConnections - session counts derived from oc_authtoken

ChristophWurst added a commit that referenced this pull request May 11, 2026
Injects LogTailReader, LoginStats, ActivityRate, and ActiveConnections —
added in #982 — into AdminSettings and passes their data to the template
params, making the services active instead of dead code.

Extracted from #977.

Co-Authored-By: Frank Karlitschek <karlitschek@users.noreply.github.com>
AI-assisted: Claude Code (claude-sonnet-4-6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst force-pushed the split/05-services-logs-sessions branch from 7684654 to b066758 Compare May 11, 2026 16:19
Adds four read-only service classes used by the upcoming admin
dashboard cards. None are wired into existing controllers yet, so
this change is a pure addition with no behavior change.

* LogTailReader     - last N WARN/ERROR entries from the JSON log
                      (no shell, line-bounded)
* LoginStats        - bruteforce attempt counters and the top
                      offending IPs over recent windows
* ActivityRate      - oc_activity row counts over the last hour /
                      day / week
* ActiveConnections - session counts derived from oc_authtoken

Signed-off-by: Frank Karlitschek <karlitschek@users.noreply.github.com>
ChristophWurst added a commit that referenced this pull request May 11, 2026
Injects LogTailReader, LoginStats, ActivityRate, and ActiveConnections —
added in #982 — into AdminSettings and passes their data to the template
params, making the services active instead of dead code.

Extracted from #977.

Co-Authored-By: Frank Karlitschek <karlitschek@users.noreply.github.com>
AI-assisted: Claude Code (claude-sonnet-4-6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst force-pushed the split/05-services-logs-sessions branch from b066758 to b34e5c4 Compare May 11, 2026 16:25
ChristophWurst added a commit that referenced this pull request May 11, 2026
Injects LogTailReader, LoginStats, ActivityRate, and ActiveConnections —
added in #982 — into AdminSettings and passes their data to the template
params, making the services active instead of dead code.

Extracted from #977.

Co-Authored-By: Frank Karlitschek <karlitschek@users.noreply.github.com>
AI-assisted: Claude Code (claude-sonnet-4-6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst force-pushed the split/05-services-logs-sessions branch from b34e5c4 to 8c232c6 Compare May 11, 2026 16:27
ChristophWurst added a commit that referenced this pull request May 11, 2026
Injects LogTailReader, LoginStats, ActivityRate, and ActiveConnections —
added in #982 — into AdminSettings and passes their data to the template
params, making the services active instead of dead code.

Extracted from #977.

Co-Authored-By: Frank Karlitschek <karlitschek@users.noreply.github.com>
AI-assisted: Claude Code (claude-sonnet-4-6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst force-pushed the split/05-services-logs-sessions branch from 8c232c6 to 9a7a730 Compare May 11, 2026 16:37
ChristophWurst added a commit that referenced this pull request May 12, 2026
Injects LogTailReader, LoginStats, ActivityRate, and ActiveConnections —
added in #982 — into AdminSettings and passes their data to the template
params, making the services active instead of dead code.

Extracted from #977.

Co-Authored-By: Frank Karlitschek <karlitschek@users.noreply.github.com>
AI-assisted: Claude Code (claude-sonnet-4-6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst force-pushed the split/05-services-logs-sessions branch from 9a7a730 to 28626fa Compare May 12, 2026 13:42
Comment thread lib/ActivityRate.php
$qb = $this->db->getQueryBuilder();
$qb->select('subjectparams', 'type')
->selectAlias($qb->func()->count('activity_id'), 'count')
->from('activity')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChristophWurst
Copy link
Copy Markdown
Member

ChristophWurst commented May 12, 2026

Activity, auth token and rate limiting are conceptually problematic. This creates an inter app dependency where this app accesses the persistence of another app directly. The technically sound way would be to go through a public API.

Looking into these right now …

@ChristophWurst
Copy link
Copy Markdown
Member

Amended the original commit to fix the DCO and added class usage like it will be used later to avoid dead code.

Copy link
Copy Markdown
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 functionality-wise

Needs decision conceptually

Comment thread lib/LoginStats.php
Comment thread lib/LogTailReader.php
'cron' => $this->cronInfo->getCronInfo(),
'jobQueue' => $this->jobQueueInfo->getJobQueueInfo(),
'slowestJobs' => $this->slowestJobs->getSlowestJobs(),
'logTail' => $this->logTailReader->recentErrors(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChristophWurst

Could we not bind them in getFrom but introduce a new controller (maybe ocs)?

This has the advantage to not block the main operation with slow operations (like expensive database queries, opening log files, etc) and also give us the ability to let the dashboard refresh without a page load in the long run.

Also okay as follow up, I would just mention it.

ChristophWurst added a commit that referenced this pull request May 12, 2026
Injects LogTailReader, LoginStats, ActivityRate, and ActiveConnections —
added in #982 — into AdminSettings and passes their data to the template
params, making the services active instead of dead code.

Extracted from #977.

Co-Authored-By: Frank Karlitschek <karlitschek@users.noreply.github.com>
AI-assisted: Claude Code (claude-sonnet-4-6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst force-pushed the split/05-services-logs-sessions branch from 28626fa to 7fbf7cc Compare May 12, 2026 17:55
Injects LogTailReader, LoginStats, ActivityRate, and ActiveConnections —
added in #982 — into AdminSettings and passes their data to the template
params, making the services active instead of dead code.

Extracted from #977.

Co-Authored-By: Frank Karlitschek <karlitschek@users.noreply.github.com>
AI-assisted: Claude Code (claude-sonnet-4-6)
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst force-pushed the split/05-services-logs-sessions branch from e7fafb7 to b48f36c Compare May 12, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants