Make polipo to log all urls

http-proxylogspolipo

i'm using polipo (proxy server) for local caching.

is there a way to log all access through polipo just like urlsnarf or other web server log file do?

logFile = "/tmp/access.log"
logLevel = ? # what should i fill to log all url?

and if possible, get cached file location also

output for 0xFF is something like this, it does not always show the requested url:

Couldn't parse last-modified: Sat, 23 Feb 2013 16:25:16 +0100
Uncacheable object http://nekovm.org/_media/neko-2.0.0.tar.gz (2120)
Superseding object: http://nekovm.org/_media/neko-2.0.0.tar.gz (200 425539 -1 (none) -> 200 425539 -1 (none))
Unsupported Cache-Control directive post-check -- ignored.
Unsupported Cache-Control directive pre-check -- ignored.
Couldn't parse last-modified: Sat, 23 Feb 2013 16:25:16 +0100
Uncacheable object http://nekovm.org/_media/neko-2.0.0.tar.gz (2120)
Superseding object: http://nekovm.org/_media/neko-2.0.0.tar.gz (200 425539 -1 (none) -> 200 425539 -1 (none))
Vary header present (Accept-Encoding).
Vary header present (Accept-Encoding).
Vary header present (Accept-Encoding).
Superseding object: http://opalrb.org/opal-parser.js (206 709851 1363984598 (none) -> 206 709851 1363984598 (none))
Vary header present (Accept-Encoding).
Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))
Vary header present (Accept-Encoding).
Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))
Vary header present (Accept-Encoding).
Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))
Vary header present (Accept-Encoding).
Superseding object: http://opalrb.org/opal-parser.js (200 709851 1363984598 (none) -> 200 709851 1363984598 (none))
Vary header present (Accept-Encoding).
Vary header present (Accept-Encoding).
Vary header present (Accept-Encoding).
Uncacheable object http://www.youtube.com/?hl=en&gl=US (2050)

Best Answer

To enable logging, the manual states that:

2.1.3 Logging

When it encounters a difficulty, Polipo will print a friendly message. The location where these messages go is controlled by the configuration variables logFile and logSyslog. If logSyslog is true, error messages go to the system log facility given by logFacility. If logFile is set, it is the name of a file where all output will accumulate. If logSyslog is false and logFile is empty, messages go to the error output of the process (normally the terminal).

The variable logFile defaults to empty if daemonise is false, and to ‘/var/log/polipo’ otherwise. The variable logSyslog defaults to false, and logFacility defaults to ‘user’.

If logFile is set, then the variable logFilePermissions controls the Unix permissions with which the log file will be created if it doesn’t exist. It defaults to 0640.

The amount of logging is controlled by the variable logLevel. Please see the file ‘log.h’ in the Polipo sources for the possible values of logLevel.

Keeping extensive logs on your users browsing habits is probably a serere violation of their privacy. If the variable scrubLogs is set, then Polipo will scrub most, if not all, private information from its logs.

Following on from that, log.h (from here) has the following levels:

#define L_ERROR 0x1
#define L_WARN 0x2
#define L_INFO 0x4
#define L_FORBIDDEN 0x8
#define L_UNCACHEABLE 0x10
#define L_SUPERSEDED 0x20
#define L_VARY 0x40
#define L_TUNNEL 0x80
#define LOGGING_DEFAULT (L_ERROR | L_WARN | L_INFO)
#define LOGGING_MAX 0xFF

So, for example, if you wanted to see all of the log messages in a file, the recommended configuation is (in /etc/polipo/config):

  logFile=/var/log/polipo
  logLevel=4
Related Question