Skip to content

Commit

Permalink
[irods#103] Change timestamp key to '@timestamp' and type to uint64_t
Browse files Browse the repository at this point in the history
  • Loading branch information
SwooshyCueb committed Nov 7, 2022
1 parent 9619976 commit d704fbc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions libirods_rule_engine_plugin-audit_amqp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <fmt/compile.h>

// stl includes
#include <cstdint>
#include <version>
#include <iostream>
#include <sstream>
Expand Down Expand Up @@ -139,7 +140,7 @@ namespace
LOG_DEBUG,
fmt::format(
"[AUDIT] - Message with timestamp:[{}] had invalid UTF-8 in key:[{}] and was stored as base64 in key:[{}].",
json_obj.at("time_stamp").get_ref<const std::string&>(),
json_obj.at("@timestamp").get_ref<const std::uint64_t&>(),
key,
key_b64)); // irods::log
}
Expand Down Expand Up @@ -228,8 +229,8 @@ namespace
std::string log_file;

try {
auto time_ms = ts_clock::now().time_since_epoch() / std::chrono::milliseconds(1);
json_obj["time_stamp"] = std::to_string(time_ms);
std::uint64_t time_ms = ts_clock::now().time_since_epoch() / std::chrono::milliseconds(1);
json_obj["@timestamp"] = time_ms;
json_obj["hostname"] = host_name;
json_obj["pid"] = std::to_string(pid);
json_obj["action"] = "START";
Expand Down Expand Up @@ -279,8 +280,8 @@ namespace
std::string log_file;

try {
auto time_ms = ts_clock::now().time_since_epoch() / std::chrono::milliseconds(1);
json_obj["time_stamp"] = std::to_string(time_ms);
std::uint64_t time_ms = ts_clock::now().time_since_epoch() / std::chrono::milliseconds(1);
json_obj["@timestamp"] = time_ms;

char host_name[MAX_NAME_LEN];
gethostname(host_name, MAX_NAME_LEN);
Expand Down Expand Up @@ -369,8 +370,8 @@ namespace
std::string log_file;

try {
auto time_ms = ts_clock::now().time_since_epoch() / std::chrono::milliseconds(1);
json_obj["time_stamp"] = std::to_string(time_ms);
std::uint64_t time_ms = ts_clock::now().time_since_epoch() / std::chrono::milliseconds(1);
json_obj["@timestamp"] = time_ms;

char host_name[MAX_NAME_LEN];
gethostname(host_name, MAX_NAME_LEN);
Expand Down

0 comments on commit d704fbc

Please sign in to comment.