Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: [Apache 2.4.17] Problem with rotatelogs when using piping |
|
Author |
|
almacore
Joined: 22 Feb 2016 Posts: 1
|
Posted: Mon 22 Feb '16 10:05 Post subject: [Apache 2.4.17] Problem with rotatelogs when using piping |
|
|
I'm trying to configure logging in Apache to achieve local logging with log rotation and sending logs to syslog server.
Something similar to that what is described here: https://www.apachelounge.com/viewtopic.php?t=3871
First option I tried is use rotatelogs with passing args and netcat:
Code: | ErrorLog "|bin/rotatelogs.exe -e logs/error.log.%Y-%m-%d-%H_%M_%S 10M |bin/nc.exe -u localhost 514" |
but then second pipe is somehow escaped and rotatelog try to interpret "bin/nc.exe..." as argument what ends with such error in logs:
Code: | Incorrect number of arguments
Usage: C:\apache\bin\rotatelogs.exe [-v] [-l] [-L linkname] [-p prog] [-f] [-t] [-e] [-n number] <logfile> {<rotation time in seconds>|<rotation size>(B|K|M|G)} [offset minutes from UTC] |
and situation that nothing is logged and nothing is sent to syslog.
Then I tried to play around with several programs and combinations and I found out that such combination:
Code: | ErrorLog "|bin/wtee.exe -a logs/wterror.log |bin/rotatelogs.exe -e logs/error.log.%Y-%m-%d-%H_%M_%S 10M |nc.exe -u localhost 514" |
ends with situation that wterror.log is created, logs are sent to syslog and rotatelog is creating files and logging to them. But the name of file created by rotatelog is: "error.log.%Y-%m-%d-%H_%M_%S". So it seems that error log stop interpreting arguments. It happens every time rotate log is not after first pipe. But if it is after first pipe second is somehow escaped....
Has anyone face such problem and have some solutions to it? Thanks for every hint!
--- split this part from https://www.apachelounge.com/viewtopic.php?t=3871 ---
It seems that in Apache 2.4.17 it stop working. I tried configuration like that:
Code: | ErrorLog "|bin/wtee.exe -a logs/wterror.log |bin/nc.exe localhost 514" |
but second pipe is skipped and everything is passed to wtee as arguments.
Do you have any solutions for that?
mod note: stick to one thread! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 26 Feb '16 11:33 Post subject: |
|
|
Why logroate? That is not made for sending its output to STDout but to a file. |
|
Back to top |
|
|
|
|
|
|