Default log file locations

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Default log file locations

Peter Bittner
Hi there!

In my day job I'm helping to get applications from traditional
environments running in cloud environments. Cloud native applications
are just "normal" applications, but there are a few properties that
they should satisfy (apart from resiliency and scalability).

For logging this boils down to what is prescribed by the 12-factor
app: The log output should be a continuous stream, i.e. simply log to
the terminal.

Now, as of today, at least on Debian based container images, the
behavior of Apache is to write to /var/log/apache2/access.log and
/var/log/apache2/error.log by default. We try to compensate this by
making those files symbolic links to /dev/stdout and /dev/stderr.
We're doing this also, because there seem to be cases when a log entry
is written _before_ it is configured via the Apache configuration
file.

From my perspective it would be advantageous to have Apache write to
the terminal by default (i.e. no hardcoded log file locations) and
allow to override this behavior via the Apache configuration file.

Is there any reason why the default behavior is not that way yet?

Peter
Reply | Threaded
Open this post in threaded view
|

Re: Default log file locations

Eric Covener
> From my perspective it would be advantageous to have Apache write to
> the terminal by default (i.e. no hardcoded log file locations) and
> allow to override this behavior via the Apache configuration file.

> Is there any reason why the default behavior is not that way yet?

I think it's useful as opt-in, but I wouldn't want to see any
"defaults" changed (whether that's how the code behaves in the absence
of logging related directives, or how our default httpd.conf looks)

One wrinkle I recall here is that the closing of stdout and stderr
happens in APR (apr_proc_detach?) and it requires a new APR release to
provide any alternate options there.
Reply | Threaded
Open this post in threaded view
|

Re: Default log file locations

Alex Hautequest
$ tail -F /var/log/apache/access_log /var/log/apache/error_log

There’s your stdout output, no code modifications needed. You are welcome.

Jokes aside, you could make use of a web socket to pull these logs out in a way code doesn’t need to be changed. Or you could dump them straight into a database. Or, IDK, there are so many ways to extract the logs from this ancient daemon, that defaulting them to stdout/stderr sounds like a bad idea - for one sole user/reason, is too much of a change.

If *maybe* the suggestion was to allow usage of stdout/stderr instead of defaulting them to those, it would be a less dramatic change, but hey, caveats are starting to appear, as Eric just pointed one out.

Alex

> On Jun 27, 2019, at 17:24, Eric Covener <[hidden email]> wrote:
>
> 
>>
>> From my perspective it would be advantageous to have Apache write to
>> the terminal by default (i.e. no hardcoded log file locations) and
>> allow to override this behavior via the Apache configuration file.
>
>> Is there any reason why the default behavior is not that way yet?
>
> I think it's useful as opt-in, but I wouldn't want to see any
> "defaults" changed (whether that's how the code behaves in the absence
> of logging related directives, or how our default httpd.conf looks)
>
> One wrinkle I recall here is that the closing of stdout and stderr
> happens in APR (apr_proc_detach?) and it requires a new APR release to
> provide any alternate options there.

Reply | Threaded
Open this post in threaded view
|

Re: Default log file locations

Michal Karm
On 06/27/2019 11:53 PM, Alex Hautequest wrote:

> $ tail -F /var/log/apache/access_log /var/log/apache/error_log
>
> There’s your stdout output, no code modifications needed. You are welcome.
>
> Jokes aside, you could make use of a web socket to pull these logs out in a way code doesn’t need to be changed. Or you could dump them straight into a database. Or, IDK, there are so many ways to extract the logs from this ancient daemon, that defaulting them to stdout/stderr sounds like a bad idea - for one sole user/reason, is too much of a change.
>
> If *maybe* the suggestion was to allow usage of stdout/stderr instead of defaulting them to those, it would be a less dramatic change, but hey, caveats are starting to appear, as Eric just pointed one out.
>
> Alex
>
>> On Jun 27, 2019, at 17:24, Eric Covener <[hidden email]> wrote:
>>
>> 
>>> From my perspective it would be advantageous to have Apache write to
>>> the terminal by default (i.e. no hardcoded log file locations) and
>>> allow to override this behavior via the Apache configuration file.
>>> Is there any reason why the default behavior is not that way yet?
>> I think it's useful as opt-in, but I wouldn't want to see any
>> "defaults" changed (whether that's how the code behaves in the absence
>> of logging related directives, or how our default httpd.conf looks)
>>
>> One wrinkle I recall here is that the closing of stdout and stderr
>> happens in APR (apr_proc_detach?) and it requires a new APR release to
>> provide any alternate options there.
>
I use -DFOREGROUND in my containers and I have always been a bit surprised that it
does not make the process to duplicate log files output to stdout/stderr.
Now that I see I am not alone I guess I can take a look at what would it take to add
an opt-in flag for this behaviour.

Would it be perhaps less intrusive to whip out a log module that could be able to
tail log files to stdout/stderr when -DFOREGROUND is used? Is it possible
to locate that fd from within a module? Or is that fd closed already even when
-DFOREGROUND is used...?  /trying to avoid depending on a new apr release/

K.

Michal Karm Babacek

--
Sent from my Hosaka Ono-Sendai Cyberspace 7



signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Default log file locations

William A Rowe Jr
In reply to this post by Eric Covener
On Thu, Jun 27, 2019 at 4:24 PM Eric Covener <[hidden email]> wrote:
> From my perspective it would be advantageous to have Apache write to
> the terminal by default (i.e. no hardcoded log file locations) and
> allow to override this behavior via the Apache configuration file.

> Is there any reason why the default behavior is not that way yet?

I think it's useful as opt-in, but I wouldn't want to see any
"defaults" changed (whether that's how the code behaves in the absence
of logging related directives, or how our default httpd.conf looks)

One wrinkle I recall here is that the closing of stdout and stderr
happens in APR (apr_proc_detach?) and it requires a new APR release to
provide any alternate options there.

If you look at the -e argument to httpd binary, you'll see that we had to offer
an alternative for those who didn't have access to / weren't satisfied with the
Windows Event Log as an early/pre-ErrorLog error emits.

Perhaps -e can be applied to Unix as well, and that some argument such as
'-' can be understood to mean stderr?