AccessLogEntry.h
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 #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 "proxyp/forward.h"
25 #include "sbuf/SBuf.h"
26 #if ICAP_CLIENT
28 #endif
29 #if USE_OPENSSL
30 #include "ssl/gadgets.h"
31 #include "ssl/support.h"
32 #endif
33 
34 /* forward decls */
35 class HttpReply;
36 class HttpRequest;
37 class CustomLog;
38 
40 {
41 
42 public:
44 
47 
51  void getLogClientIp(char *buf, size_t bufsz) const;
52 
54  const char *getClientIdent() const;
55 
57  const char *getExtUser() const;
58 
60  SBuf getLogMethod() const;
61 
63 
65 
68  // TCP/IP level details about the server or peer connection
69  // are stored in hier.tcpServer
70 
76  {
77 
78  public:
80  int code = 0;
81  const char *content_type = nullptr;
83 
85  // TODO calculate header and payload better (by parser)
86  // XXX payload encoding overheads not calculated at all yet.
88 
90  // TODO calculate header and payload better (by parser)
91  // XXX payload encoding overheads not calculated at all yet.
93 
94  } http;
95 
99  class IcpDetails
100  {
101  public:
103  } icp;
104 
109  {
110  public:
111  const char *opcode = nullptr;
112  } htcp;
113 
114 #if USE_OPENSSL
115  class SslDetails
117  {
118  public:
119  const char *user = nullptr;
121  } ssl;
122 #endif
123 
130  {
131  public:
133  caddr.setNoAddr();
134  memset(&start_time, 0, sizeof(start_time));
135  memset(&trTime, 0, sizeof(start_time));
136  }
137 
139  int64_t highOffset = 0;
140  int64_t objectSize = 0;
142  struct timeval start_time;
143  struct timeval trTime;
144  const char *rfc931 = nullptr;
145  const char *extuser = nullptr;
146 #if USE_OPENSSL
147  const char *ssluser = nullptr;
149 #endif
151  } cache;
152 
156  class Headers
157  {
158  public:
159  char *request = nullptr; //< virgin HTTP request headers
160  char *adapted_request = nullptr; //< HTTP request headers after adaptation and redirection
161  char *reply = nullptr;
162  } headers;
163 
164 #if USE_ADAPTATION
165 
169  {
170  public:
172  char *last_meta = nullptr;
173  } adapt;
174 #endif
175 
176  const char *lastAclName = nullptr;
178 
180  HttpReply *reply = nullptr;
181  HttpRequest *request = nullptr; //< virgin HTTP request
182  HttpRequest *adapted_request = nullptr; //< HTTP request after adaptation and redirection
183 
187 
190 
191 #if ICAP_CLIENT
192 
196  {
197  public:
199  memset(&trTime, 0, sizeof(trTime));
200  memset(&ioTime, 0, sizeof(ioTime));
201  memset(&processingTime, 0, sizeof(processingTime));
202  }
203 
208  int64_t bytesSent = 0;
209  int64_t bytesRead = 0;
210 
214  int64_t bodyBytesRead = -1;
215  HttpRequest* request = nullptr;
216  HttpReply* reply = nullptr;
217 
219 
223  struct timeval trTime;
229  struct timeval ioTime;
231  struct timeval processingTime;
232  }
233  icap;
234 #endif
235 
240  const SBuf *effectiveVirginUrl() const;
241 
244  {
245  if (!request)
247  }
248 
249 private:
253 };
254 
255 class ACLChecklist;
256 class StoreEntry;
257 
258 /* Should be in 'AccessLog.h' as the driver */
261 void accessLogRotate(void);
262 void accessLogClose(void);
263 void accessLogInit(void);
264 const char *accessLogTime(time_t);
265 
266 #endif /* SQUID_HTTPACCESSLOGENTRY_H */
267 
representation of a custom log directive.
Definition: CustomLog.h:22
SBuf virginUrlForMissingRequest_
const char * getClientIdent() const
Fetch the client IDENT string, or nil if none is available.
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:86
const char * XactOutcome
transaction result for logging
Definition: Elements.h:39
void log(char *format,...)
const char * bumpMode(int bm)
Definition: support.h:149
const char * getExtUser() const
Fetch the external ACL provided &#39;user=&#39; string, or nil if none is available.
void getLogClientIp(char *buf, size_t bufsz) const
MessageSizes clientReplySz
counters for the response sent to client
This subclass holds log info for HTTP protocol.
Comm::ConnectionPointer tcpClient
TCP/IP level details about the client connection.
String reqUri
ICAP Request-URI.
SBuf getLogMethod() const
Fetch the transaction method string (ICP opcode, HTCP opcode or HTTP method)
const char * lastAclName
string for external_acl_type ACL format code
HttpRequest * adapted_request
void setVirginUrlForMissingRequest(const SBuf &vu)
Remember Client URI (or equivalent) when there is no HttpRequest.
StatusCode
Definition: StatusCode.h:20
const SBuf * effectiveVirginUrl() const
HttpReply * reply
class AccessLogEntry::HtcpDetails htcp
class AccessLogEntry::AdaptationDetails adapt
This subclass holds log info for Squid internal stats.
class AccessLogEntry::Headers headers
HttpRequest * request
icp_opcode
Definition: icp_opcode.h:13
class AccessLogEntry::IcpDetails icp
class AccessLogEntry::HttpDetails http
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
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
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.
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.
HierarchyLogEntry hier
MessageSizes clientRequestSz
counters for the original request received from client
HttpRequestMethod method
#define NULL
Definition: types.h:166
ProxyProtocol::HeaderPointer proxyProtocolHeader
see ConnStateData::proxyProtocolHeader_
void accessLogInit(void)
Definition: access_log.cc:365

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors