bind-query-log-statistics
bind-query-log-statistics copied to clipboard
Wrong type for "--count" arg
The "--count" argument does not really work:
# python /var/tmp/bind-query-log-stats.py --count 10 /var/log/dns/query.log
Processing logfile /var/log/dns/query.log
<skip>
Top ['10'] DNS names requested:
Traceback (most recent call last):
File "/var/tmp/bind-query-log-stats.py", line 265, in <module>
print_top_dns_requests(COUNT)
File "/var/tmp/bind-query-log-stats.py", line 97, in print_top_dns_requests
for query, _ in Counter(DNS_QUERIES).most_common(num_print):
File "/usr/lib64/python2.7/collections.py", line 462, in most_common
return _heapq.nlargest(n, self.iteritems(), key=_itemgetter(1))
File "/usr/lib64/python2.7/heapq.py", line 465, in nlargest
result = _nlargest(n, it)
TypeError: an integer is required
@bioex remove nargs=1, from the line below and add type=int
parser.add_argument('--count', help="Number of entries to display",
default=100, type=int, metavar="Count")