Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | lithium-access_log: add a column for the forward protocol |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
de8fe7bf8cc7e2890a8368b8ea96895d |
| User & Date: | nat 2017-05-30 20:50:43.204 |
Context
|
2017-06-05
| ||
| 20:48 | lithium-dispatchers: add expiration purge to prevent termination issue check-in: bb942f62bc user: nat tags: trunk | |
|
2017-05-30
| ||
| 20:50 | lithium-access_log: add a column for the forward protocol check-in: de8fe7bf8c user: nat tags: trunk | |
|
2017-05-29
| ||
| 21:39 | lithium-dispatchers: make the new text replacement filter available check-in: 0106e2c1b7 user: nat tags: trunk | |
Changes
Changes to src/lithium-access_log.adb.
| ︙ | ︙ | |||
41 42 43 44 45 46 47 |
is (Ada.Strings.Unbounded.Length (Holder) = 0);
Empty_Holder : constant String_Holder
:= Ada.Strings.Unbounded.Null_Unbounded_String;
package String_Tables is
type Enum is
(Peer_Name, Method, Path, Http_Version, Referrer,
| | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
is (Ada.Strings.Unbounded.Length (Holder) = 0);
Empty_Holder : constant String_Holder
:= Ada.Strings.Unbounded.Null_Unbounded_String;
package String_Tables is
type Enum is
(Peer_Name, Method, Path, Http_Version, Referrer,
User_Agent, Cookies, Host, Real_IP, Forwarded_For, Forwarded_Proto);
end String_Tables;
type Holder_Array is array (String_Tables.Enum) of String_Holder;
type Extended_Log_Entry (Is_Empty : Boolean := True) is record
case Is_Empty is
when True => null;
|
| ︙ | ︙ | |||
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
& "user_agent INTEGER, "
& "cookies INTEGER, "
& "build_time REAL, "
& "export_time REAL, "
& "host INTEGER, "
& "real_ip INTEGER, "
& "forwarded_for INTEGER, "
& "FOREIGN KEY (peer_name) REFERENCES peer_names(rowid), "
& "FOREIGN KEY (method) REFERENCES methods(rowid), "
& "FOREIGN KEY (path) REFERENCES paths(rowid), "
& "FOREIGN KEY (http_version) REFERENCES http_versions(rowid), "
& "FOREIGN KEY (referrer) REFERENCES referrers(rowid), "
& "FOREIGN KEY (user_agent) REFERENCES user_agents(rowid), "
& "FOREIGN KEY (cookies) REFERENCES cookies(rowid), "
& "FOREIGN KEY (host) REFERENCES hosts(rowid), "
& "FOREIGN KEY (real_ip) REFERENCES real_ips(rowid), "
| > | > | | > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
& "user_agent INTEGER, "
& "cookies INTEGER, "
& "build_time REAL, "
& "export_time REAL, "
& "host INTEGER, "
& "real_ip INTEGER, "
& "forwarded_for INTEGER, "
& "forwarded_proto INTEGER, "
& "FOREIGN KEY (peer_name) REFERENCES peer_names(rowid), "
& "FOREIGN KEY (method) REFERENCES methods(rowid), "
& "FOREIGN KEY (path) REFERENCES paths(rowid), "
& "FOREIGN KEY (http_version) REFERENCES http_versions(rowid), "
& "FOREIGN KEY (referrer) REFERENCES referrers(rowid), "
& "FOREIGN KEY (user_agent) REFERENCES user_agents(rowid), "
& "FOREIGN KEY (cookies) REFERENCES cookies(rowid), "
& "FOREIGN KEY (host) REFERENCES hosts(rowid), "
& "FOREIGN KEY (real_ip) REFERENCES real_ips(rowid), "
& "FOREIGN KEY (forwarded_for) REFERENCES forwarded_fors(rowid), "
& "FOREIGN KEY (forwarded_proto) REFERENCES forwarded_fors(rowid));";
Insert_SQL : constant String := "INSERT INTO access "
& "(peer_name, method, path, http_version, status_code, bytes, referrer, "
& "user_agent, cookies, build_time, export_time, "
& "host, real_ip, forwarded_for, forwarded_proto) "
& "VALUES ("
& "(SELECT rowid FROM peer_names WHERE value = ?1),"
& "(SELECT rowid FROM methods WHERE value = ?2),"
& "(SELECT rowid FROM paths WHERE value = ?3),"
& "(SELECT rowid FROM http_versions WHERE value = ?4),"
& "?5, ?6, "
& "(SELECT rowid FROM referrers WHERE value = ?7),"
& "(SELECT rowid FROM user_agents WHERE value = ?8),"
& "(SELECT rowid FROM cookies WHERE value = ?9),"
& "?10, ?11, "
& "(SELECT rowid FROM hosts WHERE value = ?12),"
& "(SELECT rowid FROM real_ips WHERE value = ?13),"
& "(SELECT rowid FROM forwarded_fors WHERE value = ?14),"
& "(SELECT rowid FROM forwarded_protos WHERE value = ?15)"
& ");";
procedure Bind
(Stmt : in out SQLite3.SQLite3_Statement;
Values : in Log_Entry);
-- Bind a log entry to the main insert statement
|
| ︙ | ︙ | |||
238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
Bind (8, Values.Strings (User_Agent), "response size");
Bind (9, Values.Strings (Cookies), "response size");
Bind (10, Interfaces.C.double (Values.Build_Time), "build time");
Bind (11, Interfaces.C.double (Values.Export_Time), "export time");
Bind (12, Values.Strings (Host), "host");
Bind (13, Values.Strings (Real_IP), "real IP");
Bind (14, Values.Strings (Forwarded_For), "forwarded for");
end Bind;
procedure Bind
(Stmt : in out SQLite3.SQLite3_Statement;
Value : in String)
is
| > | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
Bind (8, Values.Strings (User_Agent), "response size");
Bind (9, Values.Strings (Cookies), "response size");
Bind (10, Interfaces.C.double (Values.Build_Time), "build time");
Bind (11, Interfaces.C.double (Values.Export_Time), "export time");
Bind (12, Values.Strings (Host), "host");
Bind (13, Values.Strings (Real_IP), "real IP");
Bind (14, Values.Strings (Forwarded_For), "forwarded for");
Bind (15, Values.Strings (Forwarded_Proto), "forwarded proto");
end Bind;
procedure Bind
(Stmt : in out SQLite3.SQLite3_Statement;
Value : in String)
is
|
| ︙ | ︙ | |||
440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
when Http_Version => return "http_versions";
when Referrer => return "referrers";
when User_Agent => return "user_agents";
when Cookies => return "cookies";
when Host => return "hosts";
when Real_IP => return "real_ips";
when Forwarded_For => return "forwarded_fors";
end case;
end Table_Name;
----------------------
-- Public Interface --
| > | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
when Http_Version => return "http_versions";
when Referrer => return "referrers";
when User_Agent => return "user_agents";
when Cookies => return "cookies";
when Host => return "hosts";
when Real_IP => return "real_ips";
when Forwarded_For => return "forwarded_fors";
when Forwarded_Proto => return "forwarded_protos";
end case;
end Table_Name;
----------------------
-- Public Interface --
|
| ︙ | ︙ | |||
481 482 483 484 485 486 487 |
Path => Hold (AWS.Status.URI (Request)),
Http_Version => Hold (AWS.Status.HTTP_Version (Request)),
Referrer => Hold_Header ("Referer"),
User_Agent => Hold_Header ("User-Agent"),
Cookies => Hold_Header ("Cookie"),
Host => Hold_Header ("Host"),
Real_IP => Hold_Header ("X-Real-IP"),
| | > | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
Path => Hold (AWS.Status.URI (Request)),
Http_Version => Hold (AWS.Status.HTTP_Version (Request)),
Referrer => Hold_Header ("Referer"),
User_Agent => Hold_Header ("User-Agent"),
Cookies => Hold_Header ("Cookie"),
Host => Hold_Header ("Host"),
Real_IP => Hold_Header ("X-Real-IP"),
Forwarded_For => Hold_Header ("X-Forwarded-For"),
Forwarded_Proto => Hold_Header ("X-Forwarded-Proto")),
Status_Code => Integer'Value (AWS.Messages.Image
(AWS.Response.Status_Code (Response))),
Bytes => Long_Integer (AWS.Response.Content_Length (Response)),
Build_Time => Build_Time,
Export_Time => Export_Time));
end Log;
|
| ︙ | ︙ |