AccessLogEntry.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 #ifndef SQUID_HTTPACCESSLOGENTRY_H
10 #define SQUID_HTTPACCESSLOGENTRY_H
11 
12 #include "anyp/PortCfg.h"
13 #include "base/RefCount.h"
14 #include "comm/Connection.h"
15 #include "HierarchyLogEntry.h"
16 #include "http/ProtocolVersion.h"
17 #include "http/RequestMethod.h"
18 #include "HttpHeader.h"
19 #include "icp_opcode.h"
20 #include "ip/Address.h"
21 #include "LogTags.h"
22 #include "MessageSizes.h"
23 #include "Notes.h"
24 #include "sbuf/SBuf.h"
25 #if ICAP_CLIENT
27 #endif
28 #if USE_OPENSSL
29 #include "ssl/gadgets.h"
30 #include "ssl/support.h"
31 #endif
32 
33 /* forward decls */
34 class HttpReply;
35 class HttpRequest;
36 class CustomLog;
37 
39 {
40 
41 public:
43 
46 
50  void getLogClientIp(char *buf, size_t bufsz) const;
51 
53  const char *getClientIdent() const;
54 
56  const char *getExtUser() const;
57 
59  SBuf getLogMethod() const;
60 
62 
64 
67  // TCP/IP level details about the server or peer connection
68  // are stored in hier.tcpServer
69 
75  {
76 
77  public:
79  int code = 0;
80  const char *content_type = nullptr;
82 
84  // TODO calculate header and payload better (by parser)
85  // XXX payload encoding overheads not calculated at all yet.
87 
89  // TODO calculate header and payload better (by parser)
90  // XXX payload encoding overheads not calculated at all yet.
92 
93  } http;
94 
98  class IcpDetails
99  {
100  public:
102  } icp;
103 
108  {
109  public:
110  const char *opcode = nullptr;
111  } htcp;
112 
113 #if USE_OPENSSL
114  class SslDetails
116  {
117  public:
118  const char *user = nullptr;
120  } ssl;
121 #endif
122 
129  {
130  public:
132  caddr.setNoAddr();
133  memset(&start_time, 0, sizeof(start_time));
134  memset(&trTime, 0, sizeof(start_time));
135  }
136 
138  int64_t highOffset = 0;
139  int64_t objectSize = 0;
141  struct timeval start_time;
142  struct timeval trTime;
143  const char *rfc931 = nullptr;
144  const char *extuser = nullptr;
145 #if USE_OPENSSL
146  const char *ssluser = nullptr;
147  Security::CertPointer sslClientCert;
148 #endif
150  } cache;
151 
155  class Headers
156  {
157  public:
158  char *request = nullptr; //< virgin HTTP request headers
159  char *adapted_request = nullptr; //< HTTP request headers after adaptation and redirection
160  char *reply = nullptr;
161  } headers;
162 
163 #if USE_ADAPTATION
164 
168  {
169  public:
171  char *last_meta = nullptr;
172  } adapt;
173 #endif
174 
175  const char *lastAclName = nullptr;
177 
179  HttpReply *reply = nullptr;
180  HttpRequest *request = nullptr; //< virgin HTTP request
181  HttpRequest *adapted_request = nullptr; //< HTTP request after adaptation and redirection
182 
186 
187 #if ICAP_CLIENT
188 
192  {
193  public:
195  memset(&trTime, 0, sizeof(trTime));
196  memset(&ioTime, 0, sizeof(ioTime));
197  memset(&processingTime, 0, sizeof(processingTime));
198  }
199 
204  int64_t bytesSent = 0;
205  int64_t bytesRead = 0;
206 
210  int64_t bodyBytesRead = -1;
211  HttpRequest* request = nullptr;
212  HttpReply* reply = nullptr;
213 
215 
219  struct timeval trTime;
225  struct timeval ioTime;
227  struct timeval processingTime;
228  }
229  icap;
230 #endif
231 };
232 
233 class ACLChecklist;
234 class StoreEntry;
235 
236 /* Should be in 'AccessLog.h' as the driver */
239 void accessLogRotate(void);
240 void accessLogClose(void);
241 void accessLogInit(void);
242 const char *accessLogTime(time_t);
243 
244 #endif /* SQUID_HTTPACCESSLOGENTRY_H */
245 
representation of a custom log directive.
Definition: CustomLog.h:22
class AccessLogEntry::IcapLogEntry icap
void accessLogClose(void)
Definition: access_log.cc:202
NotePairs::Pointer notes
void accessLogLog(AccessLogEntry::Pointer &, ACLChecklist *checklist)
Definition: access_log.cc:144
Definition: SBuf.h:87
void getLogClientIp(char *buf, size_t bufsz) const
const char * XactOutcome
transaction result for logging
Definition: Elements.h:39
void log(char *format,...)
int bumpMode
whether and how the request was SslBumped
struct timeval start_time
The time the master transaction started.
MessageSizes clientReplySz
counters for the response sent to client
struct timeval trTime
The response time.
HttpRequest * request
ICAP request.
This subclass holds log info for HTTP protocol.
const char * user
emailAddress from the SSL client certificate
char * last_meta
image of the last ICAP response header or eCAP meta received
Comm::ConnectionPointer tcpClient
TCP/IP level details about the client connection.
SBuf getLogMethod() const
Fetch the transaction method string (ICP opcode, HTCP opcode or HTTP method)
String reqUri
ICAP Request-URI.
const char * lastAclName
string for external_acl_type ACL format code
HttpRequest * adapted_request
void setNoAddr()
Definition: Address.cc:285
StatusCode
Definition: StatusCode.h:20
HttpReply * reply
class AccessLogEntry::HtcpDetails htcp
class AccessLogEntry::AdaptationDetails adapt
This subclass holds log info for Squid internal stats.
const char * getExtUser() const
Fetch the external ACL provided 'user=' string, or nil if none is available.
class AccessLogEntry::Headers headers
HttpRequest * request
Adaptation::Icap::XactOutcome outcome
final transaction status
icp_opcode
Definition: icp_opcode.h:13
class AccessLogEntry::IcpDetails icp
struct timeval processingTime
total ICAP processing time
class AccessLogEntry::HttpDetails http
Http::StatusCode resStatus
ICAP response status code.
int64_t bytesSent
number of bytes sent to ICAP server so far
This subclass holds log info for various headers in raw format.
Security::CertPointer sslClientCert
cert received from the client
logging information specific to the SSL protocol
struct timeval trTime
Transaction response time. The timer starts when the ICAP transaction is created and stops when the r...
void accessLogLogTo(CustomLog *log, AccessLogEntry::Pointer &al, ACLChecklist *checklist=NULL)
Definition: access_log.cc:74
void const char * buf
Definition: stub_helper.cc:16
class AccessLogEntry::CacheDetails cache
void accessLogRotate(void)
Definition: access_log.cc:179
class AccessLogEntry::SslDetails ssl
HttpReply * reply
ICAP reply.
This subclass holds log info for ICP protocol.
const char * accessLogTime(time_t)
String serviceName
ICAP service name.
This subclass holds log info for HTCP protocol.
struct timeval ioTime
Transaction I/O time. The timer starts when the first ICAP request byte is scheduled for sending and ...
const XactOutcome xoUnknown
initial value: outcome was not set
Definition: Elements.cc:18
AnyP::PortCfgPointer port
SBuf lastAclData
string for external_acl_type DATA format code
void syncNotes(HttpRequest *request)
This subclass holds log info for ICAP part of request.
AnyP::ProtocolVersion version
RefCount< AccessLogEntry > Pointer
Ip::Address hostAddr
ICAP server IP address.
This subclass holds general adaptation log info.
Adaptation::Icap::ICAP::Method reqMethod
ICAP request method.
HierarchyLogEntry hier
MessageSizes clientRequestSz
counters for the original request received from client
HttpRequestMethod method
#define NULL
Definition: types.h:166
const char * getClientIdent() const
Fetch the client IDENT string, or nil if none is available.
void accessLogInit(void)
Definition: access_log.cc:365
int64_t bytesRead
number of bytes read from ICAP server so far

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors