@ -61,6 +61,7 @@
# include "output-json-smtp.h"
# include "output-json-email-common.h"
# include "output-json-nfs.h"
# include "output-json-flow.h"
# include "util-byte.h"
# include "util-privs.h"
@ -85,8 +86,9 @@
# define LOG_JSON_DNP3 BIT_U16(8)
# define LOG_JSON_VARS BIT_U16(9)
# define LOG_JSON_APP_LAYER BIT_U16(10)
# define LOG_JSON_FLOW BIT_U16(11)
# define LOG_JSON_APP_LAYER_ALL (LOG_JSON_APP_LAYER|LOG_JSON_HTTP|LOG_JSON_TLS|LOG_JSON_SSH|LOG_JSON_SMTP|LOG_JSON_DNP3 )
# define LOG_JSON_APP_LAYER_ALL (LOG_JSON_APP_LAYER|LOG_JSON_HTTP|LOG_JSON_TLS|LOG_JSON_SSH|LOG_JSON_SMTP|LOG_JSON_DNP3 |LOG_JSON_FLOW )
# define JSON_STREAM_BUFFER_SIZE 4096
@ -442,6 +444,20 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
JsonAddVars ( p , p - > flow , js ) ;
}
if ( p - > flow ) {
if ( json_output_ctx - > flags & LOG_JSON_FLOW ) {
hjs = json_object ( ) ;
if ( hjs ! = NULL ) {
JsonAddFlow ( p - > flow , js , hjs ) ;
json_object_set_new ( js , " flow " , hjs ) ;
}
} else {
json_object_set_new ( js , " app_proto " ,
json_string ( AppProtoToString ( p - > flow - > alproto ) ) ) ;
}
}
/* payload */
if ( json_output_ctx - > flags & ( LOG_JSON_PAYLOAD | LOG_JSON_PAYLOAD_BASE64 ) ) {
int stream = ( p - > proto = = IPPROTO_TCP ) ?
@ -750,7 +766,13 @@ static void XffSetup(AlertJsonOutputCtx *json_output_ctx, ConfNode *conf)
const char * dnp3 = ConfNodeLookupChildValue ( conf , " dnp3 " ) ;
const char * vars = ConfNodeLookupChildValue ( conf , " vars " ) ;
const char * applayer = ConfNodeLookupChildValue ( conf , " applayer " ) ;
const char * flow = ConfNodeLookupChildValue ( conf , " flow " ) ;
if ( flow ! = NULL ) {
if ( ConfValIsTrue ( flow ) ) {
json_output_ctx - > flags | = LOG_JSON_FLOW ;
}
}
if ( vars ! = NULL ) {
if ( ConfValIsTrue ( vars ) ) {
json_output_ctx - > flags | = LOG_JSON_VARS ;