You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Thiago Bemerguy <th...@gmail.com> on 2013/03/06 13:55:16 UTC

[users@httpd] mod_cache logging

Hello,

I configured mod_cache and mod_disk_cache in my Apache Reverse Proxy, and I
want to check if the requests are being treated by the cache or sent to the
webserver, but I can't see any logs from Apache Cache modules, even the
cache files being generated in /var/cache/mod_disk_cache. How can I
configure mod_cache to generate logs?

[httpd.conf]
LogLevel debug

CustomLog logs/cached-requests.log common env=cache-hit
CustomLog logs/uncached-requests.log common env=cache-miss
CustomLog logs/revalidated-requests.log common env=cache-revalidate
CustomLog logs/invalidated-requests.log common env=cache-invalidate

LogFormat "%{cache-status}e " cachelog

CustomLog logs/cache.log cachelog

[cache.conf]

<IfModule mod_cache.c>
        <IfModule mod_disk_cache.c>
                CacheDefaultExpire 3600
                CacheEnable disk /
                CacheRoot "/var/cache/mod_disk_cache"
                CacheDirLevels 2
                CacheDirLength 1
                CacheMaxFileSize 1000000
                CacheMinFileSize 1
                CacheIgnoreCacheControl On
                CacheIgnoreNoLastMod On
                CacheIgnoreQueryString Off
                CacheIgnoreHeaders None
                CacheLastModifiedFactor 0.1
                CacheDefaultExpire 3600
                CacheMaxExpire 86400
                CacheStoreNoStore On
                CacheStorePrivate On
        </IfModule>
</IfModule>

Regards,

-- 
Thiago Bemerguy
thiagobemerguy@gmail.com

Re: [users@httpd] mod_cache logging

Posted by Thiago Bemerguy <th...@gmail.com>.
yes

 # apachectl -t -D DUMP_MODULES | grep cache
 cache_module (shared)
 disk_cache_module (shared)
Syntax OK


2013/3/6 Igor Cicimov <ic...@gmail.com>

>
>
>
> On Wed, Mar 6, 2013 at 11:55 PM, Thiago Bemerguy <thiagobemerguy@gmail.com
> > wrote:
>
>> Hello,
>>
>> I configured mod_cache and mod_disk_cache in my Apache Reverse Proxy, and
>> I want to check if the requests are being treated by the cache or sent to
>> the webserver, but I can't see any logs from Apache Cache modules, even the
>> cache files being generated in /var/cache/mod_disk_cache. How can I
>> configure mod_cache to generate logs?
>>
>> [httpd.conf]
>> LogLevel debug
>>
>> CustomLog logs/cached-requests.log common env=cache-hit
>> CustomLog logs/uncached-requests.log common env=cache-miss
>> CustomLog logs/revalidated-requests.log common env=cache-revalidate
>> CustomLog logs/invalidated-requests.log common env=cache-invalidate
>>
>> LogFormat "%{cache-status}e " cachelog
>>
>> CustomLog logs/cache.log cachelog
>>
>> [cache.conf]
>>
>> <IfModule mod_cache.c>
>>         <IfModule mod_disk_cache.c>
>>                 CacheDefaultExpire 3600
>>                 CacheEnable disk /
>>                 CacheRoot "/var/cache/mod_disk_cache"
>>                 CacheDirLevels 2
>>                 CacheDirLength 1
>>                 CacheMaxFileSize 1000000
>>                 CacheMinFileSize 1
>>                 CacheIgnoreCacheControl On
>>                 CacheIgnoreNoLastMod On
>>                 CacheIgnoreQueryString Off
>>                 CacheIgnoreHeaders None
>>                 CacheLastModifiedFactor 0.1
>>                 CacheDefaultExpire 3600
>>                 CacheMaxExpire 86400
>>                 CacheStoreNoStore On
>>                 CacheStorePrivate On
>>         </IfModule>
>> </IfModule>
>>
>> Regards,
>>
>> --
>> Thiago Bemerguy
>> thiagobemerguy@gmail.com
>>
>
> Are your caching modules enabled at all in the config? LoadModule blabla
> ...
>



-- 
Thiago Bemerguy
thiagobemerguy@gmail.com

Re: [users@httpd] mod_cache logging

Posted by Igor Cicimov <ic...@gmail.com>.
On Wed, Mar 6, 2013 at 11:55 PM, Thiago Bemerguy
<th...@gmail.com>wrote:

> Hello,
>
> I configured mod_cache and mod_disk_cache in my Apache Reverse Proxy, and
> I want to check if the requests are being treated by the cache or sent to
> the webserver, but I can't see any logs from Apache Cache modules, even the
> cache files being generated in /var/cache/mod_disk_cache. How can I
> configure mod_cache to generate logs?
>
> [httpd.conf]
> LogLevel debug
>
> CustomLog logs/cached-requests.log common env=cache-hit
> CustomLog logs/uncached-requests.log common env=cache-miss
> CustomLog logs/revalidated-requests.log common env=cache-revalidate
> CustomLog logs/invalidated-requests.log common env=cache-invalidate
>
> LogFormat "%{cache-status}e " cachelog
>
> CustomLog logs/cache.log cachelog
>
> [cache.conf]
>
> <IfModule mod_cache.c>
>         <IfModule mod_disk_cache.c>
>                 CacheDefaultExpire 3600
>                 CacheEnable disk /
>                 CacheRoot "/var/cache/mod_disk_cache"
>                 CacheDirLevels 2
>                 CacheDirLength 1
>                 CacheMaxFileSize 1000000
>                 CacheMinFileSize 1
>                 CacheIgnoreCacheControl On
>                 CacheIgnoreNoLastMod On
>                 CacheIgnoreQueryString Off
>                 CacheIgnoreHeaders None
>                 CacheLastModifiedFactor 0.1
>                 CacheDefaultExpire 3600
>                 CacheMaxExpire 86400
>                 CacheStoreNoStore On
>                 CacheStorePrivate On
>         </IfModule>
> </IfModule>
>
> Regards,
>
> --
> Thiago Bemerguy
> thiagobemerguy@gmail.com
>

Are your caching modules enabled at all in the config? LoadModule blabla ...

Re: [users@httpd] mod_cache logging

Posted by Thiago Bemerguy <th...@gmail.com>.
Thanks, it worked


2013/3/7 Eric Covener <co...@gmail.com>

> On Thu, Mar 7, 2013 at 8:12 AM, Thiago Bemerguy
> <th...@gmail.com> wrote:
> > I am using 2.2, I didn't notice it was about 2.4. Isn't there anyway to
> log
> > mod_cache in 2.2?
>
> SetEnv CACHE_MISS 1 and then log it and/or %{Age}o
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 
Thiago Bemerguy
thiagobemerguy@gmail.com

Re: [users@httpd] mod_cache logging

Posted by Eric Covener <co...@gmail.com>.
On Thu, Mar 7, 2013 at 8:12 AM, Thiago Bemerguy
<th...@gmail.com> wrote:
> I am using 2.2, I didn't notice it was about 2.4. Isn't there anyway to log
> mod_cache in 2.2?

SetEnv CACHE_MISS 1 and then log it and/or %{Age}o

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_cache logging

Posted by Thiago Bemerguy <th...@gmail.com>.
I am using 2.2, I didn't notice it was about 2.4. Isn't there anyway to log
mod_cache in 2.2?


2013/3/6 Igor Cicimov <ic...@gmail.com>

>
> On 07/03/2013 3:01 AM, "Thiago Bemerguy" <th...@gmail.com> wrote:
> >
> > http://httpd.apache.org/docs/current/mod/mod_cache.html#status
> >
> > Based on the caching decision made, the reason is also written to the
> subprocess environment under one the following four keys, as appropriate:
> >
> > cache-hit
> > The response was served from cache.
> > cache-revalidate
> > The response was stale and was successfully revalidated, then served
> from cache.
> > cache-miss
> > The response was served from the upstream server.
> > cache-invalidate
> > The cached entity was invalidated by a request method other than GET or
> HEAD.
> >
> >
> Thats for apache 2.4 i assumed you are on 2.2. Are you running 2.4?
>
>


-- 
Thiago Bemerguy
thiagobemerguy@gmail.com

Re: [users@httpd] mod_cache logging

Posted by Igor Cicimov <ic...@gmail.com>.
On 07/03/2013 3:01 AM, "Thiago Bemerguy" <th...@gmail.com> wrote:
>
> http://httpd.apache.org/docs/current/mod/mod_cache.html#status
>
> Based on the caching decision made, the reason is also written to the
subprocess environment under one the following four keys, as appropriate:
>
> cache-hit
> The response was served from cache.
> cache-revalidate
> The response was stale and was successfully revalidated, then served from
cache.
> cache-miss
> The response was served from the upstream server.
> cache-invalidate
> The cached entity was invalidated by a request method other than GET or
HEAD.
>
>
Thats for apache 2.4 i assumed you are on 2.2. Are you running 2.4?

Re: [users@httpd] mod_cache logging

Posted by Thiago Bemerguy <th...@gmail.com>.
http://httpd.apache.org/docs/current/mod/mod_cache.html#status

Based on the caching decision made, the reason is also written to the
subprocess environment under one the following four keys, as appropriate:
cache-hitThe response was served from cache.cache-revalidateThe response
was stale and was successfully revalidated, then served from cache.
cache-missThe response was served from the upstream server.cache-invalidateThe
cached entity was invalidated by a request method other than GET or HEAD.


2013/3/6 Igor Cicimov <ic...@gmail.com>

>
>
>
>
> [httpd.conf]
>> LogLevel debug
>>
>> CustomLog logs/cached-requests.log common env=cache-hit
>> CustomLog logs/uncached-requests.log common env=cache-miss
>> CustomLog logs/revalidated-requests.log common env=cache-revalidate
>> CustomLog logs/invalidated-requests.log common env=cache-invalidate
>>
>> LogFormat "%{cache-status}e " cachelog
>>
>> CustomLog logs/cache.log cachelog
>>
>>
>> Personally never heard of the above cache-* env variables, only aware of
> no-cache one. I doubt they exist and need to be set in the config somehow
> in order for your logs to work since they are set as condition for them.
> Did yoy create the config your self or you copied it from somewhere? If
> that's the case probably the part about setting those env vars was omitted
> from the guide/example you followed.
>



-- 
Thiago Bemerguy
thiagobemerguy@gmail.com

Re: [users@httpd] mod_cache logging

Posted by Igor Cicimov <ic...@gmail.com>.
[httpd.conf]
> LogLevel debug
>
> CustomLog logs/cached-requests.log common env=cache-hit
> CustomLog logs/uncached-requests.log common env=cache-miss
> CustomLog logs/revalidated-requests.log common env=cache-revalidate
> CustomLog logs/invalidated-requests.log common env=cache-invalidate
>
> LogFormat "%{cache-status}e " cachelog
>
> CustomLog logs/cache.log cachelog
>
>
> Personally never heard of the above cache-* env variables, only aware of
no-cache one. I doubt they exist and need to be set in the config somehow
in order for your logs to work since they are set as condition for them.
Did yoy create the config your self or you copied it from somewhere? If
that's the case probably the part about setting those env vars was omitted
from the guide/example you followed.