output.c (goaccess-1.6.5) | : | output.c (goaccess-1.7) | ||
---|---|---|---|---|
skipping to change at line 136 | skipping to change at line 136 | |||
}}, | }}, | |||
{CACHE_STATUS, 1, print_metrics, { | {CACHE_STATUS, 1, print_metrics, { | |||
{CHART_VBAR, hits_visitors_plot, 0, 0, NULL, NULL}, | {CHART_VBAR, hits_visitors_plot, 0, 0, NULL, NULL}, | |||
{CHART_VBAR, hits_bw_plot, 0, 0, NULL, NULL}, | {CHART_VBAR, hits_bw_plot, 0, 0, NULL, NULL}, | |||
}}, | }}, | |||
#ifdef HAVE_GEOLOCATION | #ifdef HAVE_GEOLOCATION | |||
{GEO_LOCATION, 1, print_metrics, { | {GEO_LOCATION, 1, print_metrics, { | |||
{CHART_VBAR, hits_visitors_plot, 0, 1, NULL, NULL}, | {CHART_VBAR, hits_visitors_plot, 0, 1, NULL, NULL}, | |||
{CHART_VBAR, hits_bw_plot, 0, 1, NULL, NULL}, | {CHART_VBAR, hits_bw_plot, 0, 1, NULL, NULL}, | |||
}}, | }}, | |||
{ASN, 1, print_metrics, { | ||||
{CHART_VBAR, hits_visitors_plot, 0, 0, NULL, NULL}, | ||||
{CHART_VBAR, hits_bw_plot, 0, 0, NULL, NULL}, | ||||
}}, | ||||
#endif | #endif | |||
{MIME_TYPE, 1, print_metrics, { | {MIME_TYPE, 1, print_metrics, { | |||
{CHART_VBAR, hits_visitors_plot, 0, 1, NULL, NULL}, | {CHART_VBAR, hits_visitors_plot, 0, 1, NULL, NULL}, | |||
{CHART_VBAR, hits_bw_plot, 0, 1, NULL, NULL}, | {CHART_VBAR, hits_bw_plot, 0, 1, NULL, NULL}, | |||
}}, | }}, | |||
{TLS_TYPE, 1, print_metrics, { | {TLS_TYPE, 1, print_metrics, { | |||
{CHART_VBAR, hits_visitors_plot, 0, 1, NULL, NULL}, | {CHART_VBAR, hits_visitors_plot, 0, 1, NULL, NULL}, | |||
{CHART_VBAR, hits_bw_plot, 0, 1, NULL, NULL}, | {CHART_VBAR, hits_bw_plot, 0, 1, NULL, NULL}, | |||
}}, | }}, | |||
skipping to change at line 538 | skipping to change at line 542 | |||
if (def.cwidth) | if (def.cwidth) | |||
fpskeysval (fp, "colWidth", def.cwidth, isp, 0); | fpskeysval (fp, "colWidth", def.cwidth, isp, 0); | |||
if (def.metakey) | if (def.metakey) | |||
fpskeysval (fp, "meta", def.metakey, isp, 0); | fpskeysval (fp, "meta", def.metakey, isp, 0); | |||
if (def.metatype) | if (def.metatype) | |||
fpskeysval (fp, "metaType", def.metatype, isp, 0); | fpskeysval (fp, "metaType", def.metatype, isp, 0); | |||
if (def.metalbl) | if (def.metalbl) | |||
fpskeysval (fp, "metaLabel", def.metalbl, isp, 0); | fpskeysval (fp, "metaLabel", def.metalbl, isp, 0); | |||
if (def.datatype) | if (def.datatype) | |||
fpskeysval (fp, "dataType", def.datatype, isp, 0); | fpskeysval (fp, "dataType", def.datatype, isp, 0); | |||
if (def.hlregex) | ||||
fpskeysval (fp, "hlregex", def.hlregex, isp, 0); | ||||
if (def.datakey) | if (def.datakey) | |||
fpskeysval (fp, "key", def.datakey, isp, 0); | fpskeysval (fp, "key", def.datakey, isp, 0); | |||
if (def.lbl) | if (def.lbl) | |||
fpskeysval (fp, "label", def.lbl, isp, 1); | fpskeysval (fp, "label", def.lbl, isp, 1); | |||
} | } | |||
/* Output JSON metric definition block. */ | /* Output JSON metric definition block. */ | |||
static void | static void | |||
print_def_block (FILE * fp, const GDefMetric def, int sp, int last) { | print_def_block (FILE * fp, const GDefMetric def, int sp, int last) { | |||
fpopen_obj (fp, sp); | fpopen_obj (fp, sp); | |||
skipping to change at line 802 | skipping to change at line 808 | |||
} | } | |||
/* Output JSON method definition block. */ | /* Output JSON method definition block. */ | |||
static void | static void | |||
print_def_method (FILE * fp, int sp) { | print_def_method (FILE * fp, int sp) { | |||
GDefMetric def = { | GDefMetric def = { | |||
.datakey = "method", | .datakey = "method", | |||
.lbl = MTRC_METHODS_LBL, | .lbl = MTRC_METHODS_LBL, | |||
.datatype = "string", | .datatype = "string", | |||
.cwidth = "6%", | .cwidth = "6%", | |||
.hlregex = "{" | ||||
"\\\"(\\\\\\\\b[A-Z]{3}\\\\\\\\b)\\\": \\\"<b class='cell-hl b1'>$1</b>\\\ | ||||
"," | ||||
"\\\"(\\\\\\\\b[A-Z]{4}\\\\\\\\b)\\\": \\\"<b class='cell-hl b2'>$1</b>\\\ | ||||
"," | ||||
"\\\"(\\\\\\\\b[A-Z]{5,}\\\\\\\\b)\\\": \\\"<b class='cell-hl b3'>$1</b>\\ | ||||
\"" "}", | ||||
}; | }; | |||
if (!conf.append_method) | if (!conf.append_method) | |||
return; | return; | |||
print_def_block (fp, def, sp, 0); | print_def_block (fp, def, sp, 0); | |||
} | } | |||
/* Output JSON protocol definition block. */ | /* Output JSON protocol definition block. */ | |||
static void | static void | |||
print_def_protocol (FILE * fp, int sp) { | print_def_protocol (FILE * fp, int sp) { | |||
GDefMetric def = { | GDefMetric def = { | |||
.datakey = "protocol", | .datakey = "protocol", | |||
.lbl = MTRC_PROTOCOLS_LBL, | .lbl = MTRC_PROTOCOLS_LBL, | |||
.datatype = "string", | .datatype = "string", | |||
.cwidth = "7%", | .cwidth = "7%", | |||
.hlregex = "{" | ||||
"\\\"(\\\\\\\\bHTTP/1.0\\\\\\\\b)\\\": \\\"<b class='cell-hl d1'>$1</b>\\\ | ||||
"," | ||||
"\\\"(\\\\\\\\bHTTP/1.1\\\\\\\\b)\\\": \\\"<b class='cell-hl d2'>$1</b>\\\ | ||||
"," | ||||
"\\\"(\\\\\\\\bHTTP/2\\\\\\\\b)\\\": \\\"<b class='cell-hl d3'>$1</b>\\\", | ||||
" | ||||
"\\\"(\\\\\\\\bHTTP/3\\\\\\\\b)\\\": \\\"<b class='cell-hl d4'>$1</b>\\\"" | ||||
"}", | ||||
}; | }; | |||
if (!conf.append_protocol) | if (!conf.append_protocol) | |||
return; | return; | |||
print_def_block (fp, def, sp, 0); | print_def_block (fp, def, sp, 0); | |||
} | } | |||
/* Output JSON city definition block. */ | /* Output JSON city definition block. */ | |||
static void | static void | |||
skipping to change at line 841 | skipping to change at line 857 | |||
.lbl = MTRC_CITY_LBL, | .lbl = MTRC_CITY_LBL, | |||
.datatype = "string", | .datatype = "string", | |||
}; | }; | |||
if (!conf.has_geocity) | if (!conf.has_geocity) | |||
return; | return; | |||
print_def_block (fp, def, sp, 0); | print_def_block (fp, def, sp, 0); | |||
} | } | |||
/* Output JSON ASN definition block. */ | ||||
static void | ||||
print_def_asn (FILE * fp, int sp) { | ||||
GDefMetric def = { | ||||
.datakey = "asn", | ||||
.lbl = MTRC_ASB_LBL, | ||||
.datatype = "string", | ||||
.hlregex = "{" | ||||
"\\\"^(\\\\\\\\d+)\\\": \\\"<b>$1</b>\\\"," | ||||
"\\\"^(AS\\\\\\\\d+)\\\": \\\"<b>$1</b>\\\"" "}", | ||||
}; | ||||
if (!conf.has_geoasn) | ||||
return; | ||||
print_def_block (fp, def, sp, 0); | ||||
} | ||||
/* Output JSON country definition block. */ | /* Output JSON country definition block. */ | |||
static void | static void | |||
print_def_country (FILE * fp, int sp) { | print_def_country (FILE * fp, int sp) { | |||
GDefMetric def = { | GDefMetric def = { | |||
.datakey = "country", | .datakey = "country", | |||
.lbl = MTRC_COUNTRY_LBL, | .lbl = MTRC_COUNTRY_LBL, | |||
.datatype = "string", | .datatype = "string", | |||
.hlregex = "{" "\\\"^([A-Z]{2})\\\": \\\"<b class='span-hl g5'>$1</b>\\\"" " }", | ||||
}; | }; | |||
if (!conf.has_geocountry) | if (!conf.has_geocountry) | |||
return; | return; | |||
print_def_block (fp, def, sp, 0); | print_def_block (fp, def, sp, 0); | |||
} | } | |||
/* Output JSON hostname definition block. */ | /* Output JSON hostname definition block. */ | |||
static void | static void | |||
skipping to change at line 884 | skipping to change at line 919 | |||
print_def_data (FILE * fp, GModule module, int sp) { | print_def_data (FILE * fp, GModule module, int sp) { | |||
GDefMetric def = { | GDefMetric def = { | |||
.cname = "trunc", | .cname = "trunc", | |||
.cwidth = "100%", | .cwidth = "100%", | |||
.datakey = "data", | .datakey = "data", | |||
.datatype = module == VISITORS ? "date" : "string", | .datatype = module == VISITORS ? "date" : "string", | |||
.lbl = MTRC_DATA_LBL, | .lbl = MTRC_DATA_LBL, | |||
.metakey = "unique", | .metakey = "unique", | |||
.metalbl = "Total", | .metalbl = "Total", | |||
.metatype = "numeric", | .metatype = "numeric", | |||
.hlregex = "{" "\\\"^(\\\\\\\\d+|\\\\\\\\d+xx)(\\\\\\\\s.*)$\\\": \\\"<b>$1< | ||||
/b>$2\\\"," /* 2xx Success */ | ||||
"\\\"^(AS\\\\\\\\d+)\\\": \\\"<b>$1</b>\\\"," /* AS9823 Google */ | ||||
"\\\"^(\\\\\\\\d+:)\\\": \\\"<b>$1</b>\\\"," /* 01234: Data */ | ||||
"\\\"(\\\\\\\\d+)|(:\\\\\\\\d+)|(:\\\\\\\\d+:\\\\\\\\d+)\\\": \\\"$1<b>$2< | ||||
/b>\\\"," /* 12/May/2022:12:34 */ | ||||
"\\\"^([A-Z]{2})(\\\\\\\\s.*$)\\\": \\\"<b class='span-hl g5'>$1</b>$2\\\" | ||||
" /* US United States */ | ||||
"}", | ||||
}; | }; | |||
print_def_block (fp, def, sp, 1); | print_def_block (fp, def, sp, 1); | |||
} | } | |||
/* Get the number of plots for the given panel definition. | /* Get the number of plots for the given panel definition. | |||
* | * | |||
* The number of plots for the given panel is returned. */ | * The number of plots for the given panel is returned. */ | |||
static int | static int | |||
count_plot_fp (const GHTML * def) { | count_plot_fp (const GHTML * def) { | |||
skipping to change at line 937 | skipping to change at line 978 | |||
print_def_cumts (fp, sp); | print_def_cumts (fp, sp); | |||
print_def_maxts (fp, sp); | print_def_maxts (fp, sp); | |||
if (output->method) | if (output->method) | |||
print_def_method (fp, sp); | print_def_method (fp, sp); | |||
if (output->protocol) | if (output->protocol) | |||
print_def_protocol (fp, sp); | print_def_protocol (fp, sp); | |||
print_def_city (fp, sp); | print_def_city (fp, sp); | |||
print_def_country (fp, sp); | print_def_country (fp, sp); | |||
print_def_asn (fp, sp); | ||||
print_def_hostname (fp, sp); | print_def_hostname (fp, sp); | |||
print_def_data (fp, def->module, sp); | print_def_data (fp, def->module, sp); | |||
} | } | |||
/* Output JSON panel definitions. */ | /* Output JSON panel definitions. */ | |||
static void | static void | |||
print_metrics (FILE * fp, const GHTML * def, int sp) { | print_metrics (FILE * fp, const GHTML * def, int sp) { | |||
const GOutput *output = output_lookup (def->module); | const GOutput *output = output_lookup (def->module); | |||
End of changes. 8 change blocks. | ||||
0 lines changed or deleted | 52 lines changed or added |