Code Monkey home page Code Monkey logo

Comments (2)

jiangwenyuan avatar jiangwenyuan commented on May 20, 2024

Yes

By enabling haproxy log, you can tell a hit or miss by check backend:

Dec  9 23:54:51 localhost haproxy[1487]: 127.0.0.1:54105 [09/Dec/2021:23:54:51.476] fe-cache be-cache/s1 0/0/0/1/2 200 818 - - ---- 1/1/0/0/0 0/0 "GET / HTTP/1.1"                                                                           
Dec  9 23:54:52 localhost haproxy[1487]: 127.0.0.1:54109 [09/Dec/2021:23:54:52.161] fe-cache be-cache/<NUSTER.CACHE.ENGINE> 0/0/0/0/0 200 818 - - ---- 1/1/0/0/0 0/0 "GET / HTTP/1.1"                                                        

So if the backend is <NUSTER.CACHE.ENGINE>, it's a hit.

And you can log hit header if you wish

http-response add-header hit yes if { nuster.cache.hit }                                          
declare capture response len 20                                                                   
http-response capture res.hdr(hit) id 0                                                           
                                                                                                    
log-format "|%[capture.res.hdr(0)]| %ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"                                

And you will get logs like

Dec 10 00:04:56 localhost haproxy[1572]: |yes| 127.0.0.1:54149 [10/Dec/2021:00:04:56.654] fe-cache be-cache/<NUSTER.CACHE.ENGINE> 0/0/0/0/0 200 818 - - ---- 1/1/0/0/0 0/0 {yes} "GET /? HTTP/1.1"                                           

from nuster.

akash-rp avatar akash-rp commented on May 20, 2024

Thank You

from nuster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.