homepage Welcome to WebmasterWorld Guest from 54.145.183.126
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Split apache2 logfiles
webdoctor

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3192201 posted 3:05 pm on Dec 18, 2006 (gmt 0)

A linux server running Apache 2.0.54

I have a server with many sites configured using Mass Virtual Hosting [httpd.apache.org] and apache2 is set to log to one single file (for all hosts) each day using the 'Combined' format (i.e. with the hostname at the start of each log entry), the file is called vhost.YYMMDD and is autogenerated each day.

Before processing, I need to split these logfiles using Apache's split-logfile [httpd.apache.org] command, is there an easy way to run this on every file in a folder?

BTW, running split-logfile < /var/log/apache2/vhost.* doesn't work - I've already tried :-(

 

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3192201 posted 4:45 pm on Dec 18, 2006 (gmt 0)

You could write another script (or modify the script provided) to loop through any given directory. Or, another option might be to find and exec, something along the lines of ...

find /var/log/apache2/vhost.* -exec split-logfile

Double check that syntax, at least you get an idea though.

You may want to ask this question in the *nix forum. There are some bright admins that hang out there that may have a better solution.

webdoctor

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3192201 posted 5:14 pm on Dec 18, 2006 (gmt 0)

find /var/log/apache2/vhost.* -exec split-logfile

thanks for the tip, I'll give it a try.

You may want to ask this question in the *nix forum

To save duplicate posting, might a friendly moderator move this thread over there [webmasterworld.com], please?

Receptional

WebmasterWorld Administrator receptional us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3192201 posted 5:38 pm on Dec 18, 2006 (gmt 0)

See... I am awake :) what... where am I... What's a *nix :)

gregbo

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3192201 posted 9:26 pm on Dec 18, 2006 (gmt 0)

find /var/log/apache2/vhost.* -print ¦ xargs cat ¦ split-logfile should work. If there are a lot of files, you might want to cd to /var/log/apache2 first to cut down on the file name lengths.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved