Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need a way to extract bandwidth usage logs for Apache virtual hosts. I see that a lot of people are recommending AWStats (and similar programs), but I don't need a graphical interface. All I need is usage data formatted in way that can be accessed by our billing program.

Something like this would be glorious:

<usage host="foo.com">
    <usage year="2009" month="2" bytes_in="12345" bytes_out="1235678" />
    ...
</usage>

It doesn't have to be xml, as long as it's fairly easy to parse and extract the vital information.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

If you are using apache 2+ you can use modlogio's and %I or %O in LogFormat directive

config will be something like this:

LogFormat "%v %t %I %O" billing customLog /var/log/billing.log billing

then you can use awk or perl or whatever to aggregate the data in billing log and generate the reports

share|improve this answer

I've used the mod_cband for that in the past. Its primary goal is to limit the bandwidth per vhost, but it can also log and graph them easily.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.