AccessLogEntry.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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;
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 
236  const SBuf *effectiveVirginUrl() const;
237 
240  {
241  if (!request)
243  }
244 
245 private:
249 };
250 
251 class ACLChecklist;
252 class StoreEntry;
253 
254 /* Should be in 'AccessLog.h' as the driver */
257 void accessLogRotate(void);
258 void accessLogClose(void);
259 void accessLogInit(void);
260 const char *accessLogTime(time_t);
261 
262 #endif /* SQUID_HTTPACCESSLOGENTRY_H */
263 
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
void accessLogInit(void)
Definition: access_log.cc:365

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors