ankane/dexter

Dexter don't detect anything

debnet opened this issue · 2 comments

Running dexter over my database (PostgreSQL 11.2) doesn't seems to detect anything, passing by the logs or by pg_stat_activity. No errors though, just wont detect anything at all...

(motherbase) [marc@marcbook backend]$ dexter -U postgres -d motherbase --pg-stat-activity --log-level debug2 --analyze
Started
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints
Processing 0 new query fingerprints

whereas my logs looks like the following:

2019-04-10 15:42:10.571 CEST [32086] LOG:  durée : 27696.749 ms, instruction : SELECT DISTINCT "generic_company"."id"
	FROM "generic_startup" 
	LEFT OUTER JOIN "cse_cse" ON ("generic_startup"."company_ptr_id" = "cse_cse"."startup_id") 
	INNER JOIN "cse_cse" T4 ON ("generic_startup"."company_ptr_id" = T4."startup_id") 
	INNER JOIN "generic_company" ON ("generic_startup"."company_ptr_id" = "generic_company"."id") 
	INNER JOIN "generic_startup_entities" ON ("generic_startup"."company_ptr_id" = "generic_startup_entities"."startup_id") 
	WHERE (
		T4."corporate_id" IN (
			-- SELECT U0."company_ptr_id" FROM "generic_corporate" U0 WHERE U0."company_ptr_id" IN (
				20112, 20120, 20113, 20117, 20119, 20121, 20115, 20111, 20118, 20116, 20114
			-- )
		) 
		AND NOT (
			"generic_startup"."company_ptr_id" IN (
				SELECT U1."startup_id" FROM "cse_cse" U1 WHERE U1."valid" = false
			)
		) 
		AND "generic_startup_entities"."entity_id" IN (
			SELECT U0."id" FROM "generic_entity" U0 WHERE U0."id" IN (3)
		)
	) 
	GROUP BY "generic_company"."id", "generic_startup"."company_ptr_id" 

Hey @debnet, the regex used for log parsing only checks for English messages (it expects lc_messages to be en_US.UTF-8).

REGEX = /duration: (\d+\.\d+) ms (statement|execute [^:]+): (.+)/

You can try piping the file through sed to get it to match the expected format.

LOG:  duration: 2051.529 ms  statement: SELECT 123...

Oh, OK. Good to know, an addition of that point into the documentation could be handy for the others. ;)