Answer the question
In order to leave comments, you need to log in
How to parse data by trigger before mysql insert?
Good afternoon.
Requests receive data of the form:
07-Mar-2020 18:11:34.456 queries: info: client 55.44.33.22#49230 (111.222.333.444.in-addr.arpa): view All_View: query: 111.111.111.111.in-addr.arpa IN PTR + (22.22.22.22)
Answer the question
In order to leave comments, you need to log in
SUBSTRING_INDEX(string, delimiter, number) ( https://www.w3schools.com/sql/func_mysql_substring...
SELECT
SUBSTRING_INDEX("07-Mar-2020 18:11:34.456 queries: info: client 55.44.33.22#49230 (111.222.333.444.in-addr.arpa): view All_View: query: 111.111.111.111.in-addr.arpa IN PTR + (22.22.22.22)", " queries:", 1) as `date`,
SUBSTRING_INDEX(
SUBSTRING_INDEX("07-Mar-2020 18:11:34.456 queries: info: client 55.44.33.22#49230 (111.222.333.444.in-addr.arpa): view All_View: query: 111.111.111.111.in-addr.arpa IN PTR + (22.22.22.22)", "#", 1),
" ",
-1
) as `client`,
SUBSTRING_INDEX(
SUBSTRING_INDEX(
"07-Mar-2020 18:11:34.456 queries: info: client 55.44.33.22#49230 (111.222.333.444.in-addr.arpa): view All_View: query: 111.111.111.111.in-addr.arpa IN PTR + (22.22.22.22)",
"query: ",
-1
),
" IN PTR",
1
) as `request`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question