mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-02-27 05:28:23 +00:00
Set correct db in gravity_parse. Start using with
in dnsmasq
This commit is contained in:
parent
185efaf82e
commit
14424939a9
2 changed files with 14 additions and 13 deletions
|
@ -147,21 +147,22 @@ logfile = sys.argv[1]
|
||||||
|
|
||||||
# Create the SQLite connection
|
# Create the SQLite connection
|
||||||
conn = sqlite3.connect('/etc/pihole/pihole.db')
|
conn = sqlite3.connect('/etc/pihole/pihole.db')
|
||||||
c = conn.cursor()
|
|
||||||
|
|
||||||
create_tables()
|
with conn:
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
# Parse the log file.
|
create_tables()
|
||||||
for line in open(logfile):
|
|
||||||
line = line.rstrip()
|
|
||||||
|
|
||||||
if ': query[' in line:
|
# Parse the log file.
|
||||||
parse_query(line)
|
for line in open(logfile):
|
||||||
|
line = line.rstrip()
|
||||||
|
|
||||||
elif ': forwarded ' in line:
|
if ': query[' in line:
|
||||||
parse_forward(line)
|
parse_query(line)
|
||||||
|
|
||||||
elif (': reply ' in line) or (': cached ' in line):
|
elif ': forwarded ' in line:
|
||||||
parse_reply(line)
|
parse_forward(line)
|
||||||
|
|
||||||
|
elif (': reply ' in line) or (': cached ' in line):
|
||||||
|
parse_reply(line)
|
||||||
|
|
||||||
conn.commit()
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import sqlite3
|
||||||
logfile = '/etc/pihole/pihole.2.eventHorizon.txt'
|
logfile = '/etc/pihole/pihole.2.eventHorizon.txt'
|
||||||
|
|
||||||
# Create the SQLite connection
|
# Create the SQLite connection
|
||||||
conn = sqlite3.connect('/etc/pihole/gravity.db')
|
conn = sqlite3.connect('/etc/pihole/pihole.db')
|
||||||
|
|
||||||
# Python auto-handle commits, no need to call for commits manually
|
# Python auto-handle commits, no need to call for commits manually
|
||||||
with conn:
|
with conn:
|
||||||
|
|
Loading…
Add table
Reference in a new issue