Skip to content

Commit

Permalink
ES flows have @timestamp field set to the flow expire time
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed May 13, 2015
1 parent 037e6c3 commit 7345318
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/Flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1204,20 +1204,14 @@ char* Flow::serialize(bool partial_dump, bool es_json) {
/* *************************************** */

json_object* Flow::flow2es(json_object *flow_object) {
//json_object *es_object;
struct timeval tv;
char buf[64];
struct tm* tm_info;
int len;
time_t t;

gettimeofday(&tv, NULL);
t = tv.tv_sec;
t = last_seen;
tm_info = gmtime(&t);

strftime(buf, sizeof(buf), "%FT%T", tm_info);
len = strlen(buf);
snprintf(&buf[len], sizeof(buf)-len, ".%03uZ", (unsigned int)(tv.tv_usec/1000));
strftime(buf, sizeof(buf), "%FT%T.0Z", tm_info);
json_object_object_add(flow_object, "@timestamp", json_object_new_string(buf));
json_object_object_add(flow_object, "@version", json_object_new_int(1));

Expand Down

0 comments on commit 7345318

Please sign in to comment.