]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
profiling: honor limit in json rule output
authorVictor Julien <victor@inliniac.net>
Thu, 15 Dec 2016 10:17:13 +0000 (11:17 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 16 Feb 2017 09:35:41 +0000 (10:35 +0100)
src/util-profiling-rules.c
suricata.yaml.in

index 49d1199eded49f1b7d5eee90f4387f57ce4ec157..746f9fb748a6dfc517fdb6b6ea575d706bc8c64e 100644 (file)
@@ -307,7 +307,7 @@ static void DumpJson(FILE *fp, SCProfileSummary *summary, uint32_t count, uint64
     CreateIsoTimeString(&tval, timebuf, sizeof(timebuf));
     json_object_set_new(js, "timestamp", json_string(timebuf));
 
-    for (i = 0; i < count; i++) {
+    for (i = 0; i < MIN(count, profiling_rules_limit); i++) {
         /* Stop dumping when we hit our first rule with 0 checks.  Due
          * to sorting this will be the beginning of all the rules with
          * 0 checks. */
index caecd0798ac818beced053ea1fd3d6fc31d960e1..a502bedab7b21762b216e6ae13716d0b9be59dc6 100644 (file)
@@ -1416,7 +1416,7 @@ profiling:
     # Sort options: ticks, avgticks, checks, matches, maxticks
     sort: avgticks
 
-    # Limit the number of items printed at exit (ignored for json).
+    # Limit the number of sids for which stats are shown at exit.
     limit: 100
 
     # output to json