logmgmt

package
v0.0.0-...-d283dcf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

README

module/logmgmt

Login and operation logging for gst applications.

What it provides

  • Login log — every IAM login lifecycle event (success, failure, logout) is recorded to the login_logs table by a login observer that internal/service/logmgmt installs into the authn hook at package initialization. Queryable through GET /api/log/loginlog[/:id].
  • Operation log — mutations recorded by the audit pipeline land in the operation_logs table. Queryable through GET /api/log/operationlog[/:id].
  • Retentionservicelogmgmt.Cleanup deletes rows older than the configured retention, batch by batch in independent transactions.

Add path

import "github.com/hydroan/gst/module/logmgmt"

logmgmt.Register()

Registration fails startup unless the audit pipeline is enabled (AUDIT_ENABLED=true or the audit.enabled config key): an operation log that silently stays empty would look like "no operations happened". The retention job is registered automatically; its schedule comes from the LOGMGMT_CLEANUP_CRON environment key (hourly by default — registration runs at package initialization, before configuration files are loaded), and the retention window from logmgmt.retention / LOGMGMT_RETENTION (90 days by default).

Copy path

gg module copy logmgmt

The copied service package installs the login observer the same way, through package initialization. Two manual steps remain, printed as post notes: enable the audit pipeline in configuration, and register the retention job in project-owned cronjob setup.

Tenancy

Both tables are platform-level audit data with cross-tenant reads; see TENANT.md before exposing the query routes in a multi-tenant deployment.

Documentation

Index

Constants

View Source
const (
	LoginStatusSuccess = modellogmgmt.LoginStatusSuccess
	LoginStatusFailure = modellogmgmt.LoginStatusFailure
	LoginStatusLogout  = modellogmgmt.LoginStatusLogout
)

Variables

This section is empty.

Functions

func Register

func Register()

Register registers two modules: LoginLog and OperationLog.

Models:

  • LoginLog
  • OperationLog

Routes:

  • GET /api/log/loginlog
  • GET /api/log/loginlog/:id
  • GET /api/log/operationlog
  • GET /api/log/operationlog/:id

Cronjob:

  • cleanup operationlog and loginlog hourly.

Login rows come from the authn login observer added below. That is an explicit call, like every other wiring here: nothing arms itself through a package import, so a copied module reproduces this list from project-owned assembly code instead of inheriting hidden initialization.

Operation logs come from the audit pipeline, which stays a deployment decision: the module requires AUDIT_ENABLED=true (or the audit.enabled config key) and fails startup when it is missing, instead of silently flipping the configuration on behalf of the deployment.

Types

type LoginLog

type LoginLog = modellogmgmt.LoginLog

type LoginLogModule

type LoginLogModule struct{}

func (*LoginLogModule) Param

func (*LoginLogModule) Param() string

func (*LoginLogModule) Pub

func (*LoginLogModule) Pub() bool

func (*LoginLogModule) Route

func (*LoginLogModule) Route() string

func (*LoginLogModule) Service

type LoginStatus

type LoginStatus = modellogmgmt.LoginStatus

type OperationLog

type OperationLog = modellogmgmt.OperationLog

type OperationLogModule

type OperationLogModule struct{}

func (*OperationLogModule) Param

func (*OperationLogModule) Param() string

func (*OperationLogModule) Pub

func (*OperationLogModule) Pub() bool

func (*OperationLogModule) Route

func (*OperationLogModule) Route() string

func (*OperationLogModule) Service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL