Statsfile with old statistics

Felipe Ecker felipe.ecker at azion.com
Wed Oct 19 16:10:10 UTC 2016


Why the statistics file is opened for data APPEND, instead of write-new ??

./bin/named/server.c:7616
CHECKMF(isc_stdio_open(server->statsfile, "a", &fp),
( ...)

Context:
When the control receives an input from 'rndc stats', the server.c context dumps the statistics on file after opening it for append..
So, the statsfile grows infinitely and sometimes need be truncated or deleted manually, before the next command 'rndc stats'.

This behavior is the best approach ??
I wonder If the statistic is an snapshoot of the actual moment, would be correct open the file and not overwrite the old data ??

Suggestion:
_________

diff --git a/bin/named/server.c b/bin/named/server.c
index 33483f8..3ddec0f 100644
--- a/bin/named/server.c
+++ b/bin/named/server.c
@@ -7613,7 +7613,7 @@ ns_server_dumpstats(ns_server_t *server) {
        isc_result_t result;
        FILE *fp = NULL;

-       CHECKMF(isc_stdio_open(server->statsfile, "a", &fp),
+       CHECKMF(isc_stdio_open(server->statsfile, "w", &fp),
                "could not open statistics dump file", server->statsfile);

        result = ns_stats_dump(server, fp);

[ ]’s

---
Felipe Ecker 


More information about the bind-workers mailing list