mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
Changed ES index names to localtime and added a meta index.
This commit is contained in:
parent
43507b1bb9
commit
1826827359
1 changed files with 18 additions and 1 deletions
|
@ -263,11 +263,28 @@ bool ElasticSearch::UpdateIndex(double now, double rinterval, double rbase)
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
time_t teatime = (time_t)interval_beginning;
|
time_t teatime = (time_t)interval_beginning;
|
||||||
gmtime_r(&teatime, &tm);
|
localtime_r(&teatime, &tm);
|
||||||
strftime(buf, sizeof(buf), "%Y%m%d%H%M", &tm);
|
strftime(buf, sizeof(buf), "%Y%m%d%H%M", &tm);
|
||||||
|
|
||||||
prev_index = current_index;
|
prev_index = current_index;
|
||||||
current_index = index_prefix + "-" + buf;
|
current_index = index_prefix + "-" + buf;
|
||||||
|
|
||||||
|
// Send some metadata about this index.
|
||||||
|
buffer.AddRaw("{\"index\":{\"_index\":\"@", 21);
|
||||||
|
buffer.Add(index_prefix);
|
||||||
|
buffer.AddRaw("-meta\",\"_type\":\"index\",\"_id\":\"", 30);
|
||||||
|
buffer.Add(current_index);
|
||||||
|
buffer.AddRaw("-", 1);
|
||||||
|
buffer.Add(Info().rotation_base);
|
||||||
|
buffer.AddRaw("-", 1);
|
||||||
|
buffer.Add(Info().rotation_interval);
|
||||||
|
buffer.AddRaw("\"}}\n{\"name\":\"", 13);
|
||||||
|
buffer.Add(current_index);
|
||||||
|
buffer.AddRaw("\",\"start\":", 10);
|
||||||
|
buffer.Add(interval_beginning);
|
||||||
|
buffer.AddRaw(",\"end\":", 7);
|
||||||
|
buffer.Add(interval_beginning+rinterval);
|
||||||
|
buffer.AddRaw("}\n", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("%s - prev:%s current:%s\n", Info().path.c_str(), prev_index.c_str(), current_index.c_str());
|
//printf("%s - prev:%s current:%s\n", Info().path.c_str(), prev_index.c_str(), current_index.c_str());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue