I have to define about 100 subdomain virtualhost entries in server config file . I want to know if there is any way to do it with regular expression to increase codes in apache config file?
You should have a look at this how to from the Apache documentation, I think that's what you need here:
Using Mass Virtual Hosting forbids the use of different log files:
However this is not really a problem because you can use the %v filter for CustomLog which places the ServerName in front of each logged request, you can then filter and split logs if necessary based on this.
A good practice is to put those logs in a mysql database (on the fly or through a cronjob, pipe or a fifo file) because SQL is a great tool to extract meaningful informations from them.
Storing your logs directly in a database mysql can be a good solution through the ARCHIVE storage engine but it has its own limitations (lock table on write). An alternative would be building you system on a more standard storage engine (innodb, xtradb for example), if you already have a mysql server I'd try that before other solutions as it doesn't require much learning.
If you feel a little more adventurous you can have a look at MongoDB, as a document oriented database it is particularly fit as a log storage system (fast, powerful filter capabilities, speed of insertion/read) but be sure to have a good dedicated server for it as you'll need RAM for it to behave adequately.
You'll find details on MongoDB logging here:
No, but what are you trying to do? Having a regex in the