Skip to content

Commit

Permalink
Fixing querys
Browse files Browse the repository at this point in the history
Signed-off-by: Luis Felipe Domínguez Vega <[email protected]>
  • Loading branch information
lfdominguez committed Jun 27, 2019
1 parent 28e379c commit 646a23d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ fn main() {

access_counter.inc();

//SELECT count(*) FROM log WHERE auth=1 AND active=1 AND timestamp > (strftime('%s', 'now') * 1 - 3600);

let mut statement = connection
.prepare("SELECT session_id, node, username, common_name, real_ip, vpn_ip, duration, bytes_in, bytes_out, active, auth FROM log WHERE active = 1")
.prepare("SELECT session_id, node, username, common_name, real_ip, vpn_ip, duration, bytes_in, bytes_out, active, auth FROM log WHERE active = 1 AND auth=1 AND timestamp > (strftime('%s', 'now') * 1 - 3600)")
.unwrap();

while let State::Row = statement.next().unwrap() {
Expand All @@ -115,8 +117,8 @@ fn main() {
&statement.read::<String>(3).unwrap()[..],
&statement.read::<String>(4).unwrap()[..],
&statement.read::<String>(5).unwrap()[..],
&statement.read::<String>(6).unwrap()[..],
&statement.read::<String>(7).unwrap()[..]
&statement.read::<String>(8).unwrap()[..],
&statement.read::<String>(9).unwrap()[..]
];

duration.with_label_values(&label_values).set(statement.read::<f64>(5).unwrap());
Expand Down

0 comments on commit 646a23d

Please sign in to comment.