Hit counter persistent variables
manlio_perillo at libero.it
Wed Aug 20 14:56:46 MSD 2008
Chris Savery ha scritto:
> Is there a way to have hit counter variables that would save every hour
> or persist across restarts?
> I'm working on a photography site that I expect to be serving a huge
> number of thumbnail (static) images. I don't need full logging of the
> thumbnails so I've turned if off for that location but it sure would be
> nice to keep some tracking of how many are served and perhaps at what
> rate. I thought maybe just a counter variable that increments on each
> hit in that location but it wouldn't be too useful unless it could save
> to file from time to time, or perhaps append a count to a file every
> hour so there is a time series log.
You can write an Nginx module that use, as an example, gdbm to store
data, protected with a lock.
More information about the nginx