MEDIUM: stats: add proxy name filtering on the statistic page
This patch adds a "scope" box in the statistics page in order to
display only proxies with a name that contains the requested value.
The scope filter is preserved across all clicks on the page.
diff --git a/include/common/standard.h b/include/common/standard.h
index 4de4f73..df061b2 100644
--- a/include/common/standard.h
+++ b/include/common/standard.h
@@ -745,4 +745,7 @@
*/
#define fddebug(msg...) do { char *_m = NULL; memprintf(&_m, ##msg); if (_m) write(-1, _m, strlen(_m)); free(_m); } while (0)
+/* same as strstr() but case-insensitive */
+const char *strnistr(const char *str1, int len_str1, const char *str2, int len_str2);
+
#endif /* _COMMON_STANDARD_H */
diff --git a/include/proto/dumpstats.h b/include/proto/dumpstats.h
index 0674c32..9b41961 100644
--- a/include/proto/dumpstats.h
+++ b/include/proto/dumpstats.h
@@ -54,6 +54,11 @@
#define STAT_CLI_O_SET 10 /* set entries in tables */
#define STAT_CLI_O_STAT 11 /* dump stats */
+/* HTML form to limit output scope */
+#define STAT_SCOPE_TXT_MAXLEN 20 /* max len for scope substring */
+#define STAT_SCOPE_INPUT_NAME "scope" /* pattern form scope name <input> in html form */
+#define STAT_SCOPE_PATTERN "?" STAT_SCOPE_INPUT_NAME "="
+
extern struct si_applet http_stats_applet;
void stats_io_handler(struct stream_interface *si);
diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h
index a808491..2500894 100644
--- a/include/types/stream_interface.h
+++ b/include/types/stream_interface.h
@@ -124,6 +124,8 @@
struct proxy *px;
struct server *sv;
void *l;
+ int scope_str; /* limit scope to a frontend/backend substring */
+ int scope_len; /* length of the string above in the buffer */
int px_st; /* STAT_PX_ST* */
unsigned int flags; /* STAT_* */
int iid, type, sid; /* proxy id, type and service id if bounding of stats is enabled */