Refactor `replit.md` to include `./push-gitlab.sh` deployment. Update `shared/schema.ts` and `database-schema/create_network_logs.sql` to change `routerId` to `routerName` in `networkLogs`, remove the relation, and update fields like `destIp` to `destinationIp`, `bytes`/`packets` to `packetLength`, and add `rawMessage`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: d2b716bd-04d1-48e8-b4e3-1e6d950d8a15 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/MkBJZ0L
36 lines
1.2 KiB
SQL
36 lines
1.2 KiB
SQL
-- =========================================================
|
|
-- SCHEMA: Tabella network_logs per IDS MikroTik
|
|
-- =========================================================
|
|
-- Creata per compatibilità con syslog_parser.py
|
|
-- =========================================================
|
|
|
|
-- Drop tabella se esiste (solo per ambiente di sviluppo)
|
|
DROP TABLE IF EXISTS network_logs CASCADE;
|
|
|
|
-- Crea tabella network_logs
|
|
CREATE TABLE network_logs (
|
|
id VARCHAR PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
router_name TEXT NOT NULL,
|
|
timestamp TIMESTAMP NOT NULL,
|
|
source_ip TEXT NOT NULL,
|
|
source_port INTEGER,
|
|
destination_ip TEXT,
|
|
destination_port INTEGER,
|
|
protocol TEXT,
|
|
action TEXT,
|
|
packet_length INTEGER,
|
|
raw_message TEXT,
|
|
created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
-- Indici per performance
|
|
CREATE INDEX IF NOT EXISTS source_ip_idx ON network_logs(source_ip);
|
|
CREATE INDEX IF NOT EXISTS timestamp_idx ON network_logs(timestamp);
|
|
CREATE INDEX IF NOT EXISTS router_name_idx ON network_logs(router_name);
|
|
|
|
-- Commento tabella
|
|
COMMENT ON TABLE network_logs IS 'Log di rete da router MikroTik via syslog (parsati da syslog_parser.py)';
|
|
|
|
-- Verifica
|
|
SELECT 'Tabella network_logs creata con successo!' AS status;
|