So the following command is working great for me but I want to pull and parse data twice in one query with the sustring command. I have a good bit of syslog data being dumped into one field and I need to run multiple substring commands to print it correctly. Hopefully I will find help here because the MySQL forums where of no help at all:-\
select ReceivedAt, substring(Message,POSITION('access' in Message)+35, POSITION('/'in Message)-17)as Outside
from SystemEvents
where Message like'%denied%'
and DATE(ReceivedAt) = DATE(NOW())
order by ReceivedAt DESC
Output Looks Like
ReceivedAt Outside
2010-01-04 13:50:40 219.136.22.29(80)
2010-01-04 12:22:40 66.136.42.29(80)
------------
I would like to pull data twice from the Message field with the following command but when I run the query I get the following error.
(Operand should contain 1 column(s)Error# 1241)
select ReceivedAt, substring(Message,POSITION('access' in Message)+35, POSITION('/'in Message)-17)as Outside, (Message,POSITION('access' in Message)+20, POSITION('/'in Message)-15)as Port
from SystemEvents;
where Message like'%denied%'
and DATE(ReceivedAt) = DATE(NOW())
order by ReceivedAt DESC
So how do I pull data twice with 2 -3 substring commands from one field and print it correctly.
It should look something like this:
ReceivedAt Outside Port
2010-01-04 13:50:40 219.136.22.29(80) 443
Many Thanks