Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Turris
ucollect
Commits
e9c539a4
Unverified
Commit
e9c539a4
authored
Aug 29, 2017
by
Robin Obůrka
Browse files
master: Fix flow insertion
parent
5e66d6b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/master/flow_plugin.py
View file @
e9c539a4
...
...
@@ -221,7 +221,7 @@ def store_flows(max_records, client, message, expect_conf_id, now):
logger
.
warn
(
"Unexpectedly high number of flows in the message from client %s - %s connection, max expected %s. Ignoring."
,
client
,
count
,
max_records
)
return
with
database
.
transaction
()
as
t
:
t
.
executemany
(
"INSERT INTO biflows (client, ip_local, ip_remote, port_local, port_remote, proto, start_in, start_out, stop_in, stop_out, count_in, count_out, size_in, size_out, seen_start_in, seen_start_out, seen_end_in, seen_end_out, seen_rst) SELECT clients.id, %s, %s, %s, %s, %s, %s - %s * INTERVAL '1 millisecond', %s - %s * INTERVAL '1 millisecond', %s - %s * INTERVAL '1 millisecond', %s - %s * INTERVAL '1 millisecond', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s FROM clients WHERE clients.name = %s"
,
values
)
t
.
executemany
(
"INSERT INTO biflows (client, ip_local, ip_remote, port_local, port_remote, proto, start_in, start_out, stop_in, stop_out, count_in, count_out, size_in, size_out, seen_start_in, seen_start_out, seen_end_in, seen_end_out, seen_rst
, tagged_on
) SELECT clients.id, %s, %s, %s, %s, %s, %s - %s * INTERVAL '1 millisecond', %s - %s * INTERVAL '1 millisecond', %s - %s * INTERVAL '1 millisecond', %s - %s * INTERVAL '1 millisecond', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s FROM clients WHERE clients.name = %s"
,
values
)
logger
.
debug
(
"Stored %s flows for %s"
,
count
,
client
)
class
FlowPlugin
(
plugin
.
Plugin
,
diff_addr_store
.
DiffAddrStore
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment