-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[email protected] wrote:
| # read first line
| #...
|
| while [ $result -eq 0 ]; do
|   # log $line to $filename
|   logger -p local0.info -t "APACHE" "$filename?$line"
|   read line
|   result=$?
| done

You are spawning a logger process for each log line... brrrr....

| Or is there a more "best-practices" approach to do what I want (which is :
| filter messages on the remote end based on the tag and write them to a
| dynamically generated filename using regexps)

Personally I do this way:

On the apache side for every VirtualHost:

ErrorLog "|/usr/bin/logger -p local5.err -t http_example.com"
CustomLog "|/usr/bin/logger -p local5.info -t http_example.com" combined

On the rsyslog side:

# Let the message "untouched" without adding any information for easy
# parsing by webalizer & company
$template ApacheLog,"%msg:2:$:drop-last-lf%\r\n"

# Define an archiving policy that allows for simpler analisys and archiving
# The number 58 should be tuned for your system. Obviously everything must
# be on the same line.
$template
ArchiveApache,"/var/log/apache/%$YEAR%/%$MONTH%/%$DAY%/%syslogtag:F,58:1%_%syslogseverity-text%.log"

# Define the destinations and prevent writing on other standard logs
# Put this near the beginning of the conf file
:syslogtag,startswith,"http"    -?ArchiveApache;ApacheLog
:syslogtag,startswith,"http"    ~


- --
Flavio Visentin
GPG Key: http://www.zipman.it/gpgkey.asc

There are only 10 types of people in this world:
those who understand binary, and those who don't.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknI3yMACgkQusUmHkh1cnrISACfQNkWSda9yPICMM/ie78SGhLe
FOMAniAk8S0coDfgCSNQp/IXGqCRfZd2
=IhIf
-----END PGP SIGNATURE-----
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com

Reply via email to