I am monitoring apache logs and writing them to MySQL. The field request_URI always contains a forward slash before the actual URI, for example:
/universe.jpg
Which is normal and fine. Except I need to execute some queries against this field and it would be great if the forward slash wasn't there when I do those queries. I can do SUBSTRING(request_uri FROM 2) in the query, but I'd rather just filter out the forward slash before it is written to the database.
Is there some way to do that so that the forward slash never ends up in the field at all?
Thank you.
Need to alter data as written to database
Moderator: General Moderators
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: Need to alter data as written to database
Yes, you do the substr just before the insert when you're writing the recordsbulgin wrote:Is there some way to do that so that the forward slash never ends up in the field at all?
Re: Need to alter data as written to database
I'm using mod_log_mysql, an Apache 2.0 module that writes logging data directly to a MySQL database.
I'm too much of a newbie to know how this occurs or where to look so that I can use the substring. If I was writing to the database naturally I could use the string, but I'm clueless when it comes to this process...
I'm too much of a newbie to know how this occurs or where to look so that I can use the substring. If I was writing to the database naturally I could use the string, but I'm clueless when it comes to this process...