-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import data from long-term database #208
Conversation
…ed it in database.c) Signed-off-by: DL6ER <dl6er@dl6er.de>
…TL. Fall back to log interpretation if database is not available Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
…rvers for the actual IPs. In think case we have to decrease the "cached" counter Signed-off-by: DL6ER <dl6er@dl6er.de>
…s counted Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
queries[queryID].timeidx = timeidx; | ||
queries[queryID].valid = true; // Mark this as a valid query (false = it has been garbage collected and should be skipped) | ||
queries[queryID].db = true; // Mark this as already present in the database | ||
queries[queryID].id = 0; // This is dnsmasq's internal ID. We don't store it in the database |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure, the dnsmasq query IDs don't start at 0, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it starts with 1
.
@@ -587,27 +578,21 @@ void process_pihole_log(int file) | |||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing free(forward)
parser.c
Outdated
@@ -587,27 +578,21 @@ void process_pihole_log(int file) | |||
continue; | |||
} | |||
|
|||
// Count only if current query has not been counted so far | |||
if(queries[i].complete) | |||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing free(forward)
extracttimestamp(readbuffer, &querytimestamp, &overTimetimestamp); | ||
|
||
// Check if this query has already been imported from the database | ||
if(querytimestamp < lastDBimportedtimestamp) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are more of this line below, but since this is run on every line, the others would just be redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, they shouldn't be there, seems like I forgot to remove them at some places.
Signed-off-by: DL6ER <dl6er@dl6er.de>
By submitting this pull request, I confirm the following (please check boxes, eg [X]) Failure to fill the template will close your PR:
Please submit all pull requests against the
development
branch. Failure to do so will delay or deny your requestHow familiar are you with the codebase?:
10
This pull requests implements some general improvements for
FTL
.Changes:
pihole.log
andpihole.log.1
each timeFTL
starts up, we read the already analyzed and categorized data from the long term database. We only read those queries frompihole.log
that are not already present in the database. This enhances the startup speed ofFTL
as well as provides some functionality we will be using withFTL
in the future.Forward Destinations (integrated)
plot and is implemented to acknowledge the fact that we store only one forward destination per query in the database.Minor fixes:
<CNAME>
record but still have to ask the upstream servers for the actual IP addresses, we don't count this query as being cached but as being forwarded. Note that this will reduce thelocal
forward destination count (it has been too high so far).validate_access()
calls at some places for a slight performance increase.This template was created based on the work of
udemy-dl
.