stats: replace dashes by underscores in app-layer protocols

Ticket: 6502

Forbid dashes in json keys for better use by processing tools
pull/15315/head
Philippe Antoine 3 months ago committed by Victor Julien
parent d030ea7f29
commit 54c02e1301

@ -57,6 +57,10 @@ Logging Changes
- Alert verdict key is changed from to ``reject-target`` to ``reject_target``
- App-layer stats protocols names replace dash by underscore, meaning
``stats.app_layer.*.ftp-data`` becomes ``stats.app_layer.*.ftp_data``,
and same for bittorrent_dht
Other Changes
~~~~~~~~~~~~~
- ``engine-analysis`` output has been changed for keywords that now use the generic integers framework

@ -5736,7 +5736,7 @@
"type": "object",
"additionalProperties": false,
"properties": {
"bittorrent-dht": {
"bittorrent_dht": {
"description":
"Errors encountered parsing BitTorrent DHT protocol",
"$ref": "#/$defs/stats_applayer_error"
@ -5784,7 +5784,7 @@
"description": "Errors encountered parsing FTP",
"$ref": "#/$defs/stats_applayer_error"
},
"ftp-data": {
"ftp_data": {
"description": "Errors encountered parsing FTP data",
"$ref": "#/$defs/stats_applayer_error"
},
@ -5914,7 +5914,7 @@
"type": "object",
"additionalProperties": false,
"properties": {
"bittorrent-dht": {
"bittorrent_dht": {
"type": "integer",
"description": "Number of flows for BitTorrent DHT protocol"
},
@ -5965,7 +5965,7 @@
"type": "integer",
"description": "Number of flows for FTP"
},
"ftp-data": {
"ftp_data": {
"type": "integer",
"description": "Number of flows for FTP data protocol"
},
@ -6093,7 +6093,7 @@
"type": "object",
"additionalProperties": false,
"properties": {
"bittorrent-dht": {
"bittorrent_dht": {
"type": "integer",
"description":
"Number of transactions for BitTorrent DHT protocol"
@ -6137,7 +6137,7 @@
"type": "integer",
"description": "Number of transactions for FTP"
},
"ftp-data": {
"ftp_data": {
"type": "integer",
"description": "Number of transactions for FTP data protocol"
},

@ -1240,7 +1240,16 @@ void AppLayerSetupCounters(void)
for (AppProto alproto = 0; alproto < g_alproto_max; alproto++) {
if (alprotos[alproto] == 1) {
const char *tx_str = "app_layer.tx.";
const char *alproto_str = AppLayerGetProtoName(alproto);
const char *alproto_raw = AppLayerGetProtoName(alproto);
char alproto_str[32];
for (size_t i = 0; i < 32; i++) {
alproto_str[i] = alproto_raw[i];
if (alproto_str[i] == 0) {
break;
} else if (alproto_str[i] == '-') {
alproto_str[i] = '_';
}
}
memset(ipprotos_all, 0, sizeof(ipprotos_all));
AppLayerProtoDetectSupportedIpprotos(alproto, ipprotos_all);

Loading…
Cancel
Save