FormatSquidUseragent.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* DEBUG: section 46 Access Log - Squid useragent format */
10 
11 #include "squid.h"
12 #include "AccessLogEntry.h"
13 #include "HttpRequest.h"
14 #include "log/File.h"
15 #include "log/Formats.h"
16 #include "SquidTime.h"
17 
18 void
20 {
21  const char *agent = NULL;
22 
23  if (al->request)
25 
26  if (!agent || *agent == '\0')
27  agent = "-";
28 
29  char clientip[MAX_IPSTRLEN];
30  al->getLogClientIp(clientip, MAX_IPSTRLEN);
31 
32  logfilePrintf(logfile, "%s [%s] \"%s\"\n",
33  clientip,
35  agent);
36 }
37 
void logfilePrintf(Logfile *lf, const char *fmt,...)
Definition: File.cc:112
Definition: File.h:38
void getLogClientIp(char *buf, size_t bufsz) const
time_t squid_curtime
Definition: stub_time.cc:17
HttpRequest * request
const char * getStr(Http::HdrType id) const
Definition: HttpHeader.cc:1178
HttpHeader header
Definition: Message.h:75
static FILE * logfile
void SquidUserAgent(const AccessLogEntryPointer &al, Logfile *logfile)
Display log details in useragent format.
const char * FormatHttpd(time_t t)
Definition: stub_time.cc:25
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:23
#define NULL
Definition: types.h:166

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors