Skip to content

Commit

Permalink
syslog-ng-otlp: only send non-local tags to the peer
Browse files Browse the repository at this point in the history
Signed-off-by: Balazs Scheidler <[email protected]>
  • Loading branch information
bazsi committed Feb 4, 2024
1 parent 33a5e23 commit a9c807f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions modules/grpc/otel/otel-protobuf-formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,18 +584,16 @@ ProtobufFormatter::set_syslog_ng_macros(LogMessage *msg, LogRecord &log_record)
m->set_key("m");
KeyValueList *macros_kvlist = m->mutable_value()->mutable_kvlist_value();

LogMessageValueType type;
gssize len;
const char *value;

KeyValue *pri_attr = macros_kvlist->add_values();
pri_attr->set_key("PRI");
pri_attr->mutable_value()->set_int_value(msg->pri);

value = log_msg_get_value_by_name_with_type(msg, "TAGS", &len, &type);
GString *tags_value = g_string_sized_new(64);
log_msg_format_tags(msg, tags_value, FALSE);
KeyValue *tags_attr = macros_kvlist->add_values();
tags_attr->set_key("TAGS");
tags_attr->mutable_value()->set_bytes_value(value, len);
tags_attr->mutable_value()->set_bytes_value(tags_value->str, tags_value->len);
g_string_free(tags_value, TRUE);

KeyValue *stamp_gmtoff = macros_kvlist->add_values();
stamp_gmtoff->set_key("STAMP_GMTOFF");
Expand Down

0 comments on commit a9c807f

Please sign in to comment.