i need filter query log , needs newlines , have stuck in regex filtering new lines
here example of log want filter
139 connect root@localhost anonymous on 139 query set character set 'utf8mb4' 139 query set collation_connection = 'utf8mb4_unicode_ci' 139 query select current_user() 139 query flush privileges 139 query select * `mysql`.`db` limit 1 139 query delete `mysql`.`db` `host` = "" , `db` = "" , `user` = "" limit 1 139 query insert `mysql`.`db`(`host`, `db`, `user`) values("pma_test_host", "mysql", "pma_test_user") 139 query delete `mysql`.`db` host = "pma_test_host" , db = "mysql" , user = "pma_test_user" limit 1 139 query update `mysql`.`db` set `host` = "" `host` = "" , `db` = "" , `user` = "" limit 1
from log text have used regex this
(?=query).*
but search result in line
query set character set 'utf8mb4'
because use character of "." in regex mean not doing search in new line. i've tried put "\n" in few way doesn't work. need suggestion result this:
query set character set 'utf8mb4' 139 query set collation_connection = 'utf8mb4_unicode_ci' 139 query select current_user() 139 query flush privileges 139 query select * `mysql`.`db` limit 1 139 query delete `mysql`.`db` `host` = "" , `db` = "" , `user` = "" limit 1 139 query insert `mysql`.`db`(`host`, `db`, `user`) values("pma_test_host", "mysql", "pma_test_user") 139 query delete `mysql`.`db` host = "pma_test_host" , db = "mysql" , user = "pma_test_user" limit 1 139 query update `mysql`.`db` set `host` = "" `host` = "" , `db` = "" , `user` = "" limit 1
you may use regex like
(?=query)[\s\s]*
it check if there query
left of current location , consume (will put match value) 0+ chars (including line breaks).
Comments
Post a Comment