Skip to content

Commit

Permalink
Deduplicate, add more information
Browse files Browse the repository at this point in the history
Removed duplicate "action" element.
Added decoder name and parent.
Added hostname.
  • Loading branch information
reyjrar committed Aug 12, 2016
1 parent aefeecf commit 4985d87
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/analysisd/format/to_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ char *Eventinfo_to_jsonstr(const Eventinfo *lf)
cJSON_AddStringToObject(rule, "info", lf->generated_rule->info);
}

if( lf->decoder_info->name ) {
cJSON_AddStringToObject(root, "decoder", lf->decoder_info->name);
}
if( lf->decoder_info->parent ) {
cJSON_AddStringToObject(root, "decoder_parent", lf->decoder_info->parent);
}

if (lf->action) {
cJSON_AddStringToObject(root, "action", lf->action);
Expand Down Expand Up @@ -119,9 +125,6 @@ char *Eventinfo_to_jsonstr(const Eventinfo *lf)
if ( lf->data ) {
cJSON_AddStringToObject(root, "data", lf->data);
}
if ( lf->action ) {
cJSON_AddStringToObject(root, "action", lf->action);
}
if ( lf->url ) {
cJSON_AddStringToObject(root, "url", lf->url);
}
Expand All @@ -131,6 +134,9 @@ char *Eventinfo_to_jsonstr(const Eventinfo *lf)
if ( lf->status ) {
cJSON_AddStringToObject(root, "status", lf->status);
}
if ( lf->hostname ) {
cJSON_AddStringToObject(root, "hostname", lf->hostname);
}
if ( lf->program_name ) {
cJSON_AddStringToObject(root, "program_name", lf->program_name);
}
Expand Down

0 comments on commit 4985d87

Please sign in to comment.