pylon
The Pihole query log extraction, conversion and export tool
Pylon is a command line tool that allows dumping Pihole query log from the pihole-FTL.db
file
in one of the following formats:
- Line-delimited JSON for further processing with tools such as
jq
- InfluxDB Line Protocol format for import by Telegraf
Pylon also has ability to export and send Pihole query logs to external systems. At this moment,
it only supports InfluxDB v2.
Examples
$ pylon dump \
--start '2023-02-01T00:00:00Z' \
--end '2023-02-28T23:59:59Z' \
--format json \
/etc/pihole/pihole-FTL.db
# Example output
{
"timestamp": "2023-02-03T09:46:58.986-08:00",
"type": "A",
"decision": "ALLOWED",
"reason": "CACHED",
"domain": "example.com",
"client": "127.0.0.1",
"forward": "NONE",
"reply_type": "IP",
"reply_time": 100000,
"dnssec": "UNKNOWN"
}
Send all Pihole queries made in Feb 2023 to InfluxDB2
$ export INFLUXDB2_URL='https://influxdb.example.com'
$ export INFLUXDB2_TOKEN='super-secret-token'
$ pylon export \
--start '2023-02-01T00:00:00Z' \
--end '2023-02-28T23:59:59Z' \
--dest influxdb2 \
--influxdb2-org 'ExampleOrg' \
--incluxdb2-bucket 'ExampleBucket' \
/etc/pihole/pihole-FTL.db
License
MIT