Skip to content

Commit

Permalink
syslog-ng-otlp: send & expect the $PRI value as an integer
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 fc058b7 commit 33a5e23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions modules/grpc/otel/otel-protobuf-formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,9 @@ ProtobufFormatter::set_syslog_ng_macros(LogMessage *msg, LogRecord &log_record)
gssize len;
const char *value;

value = log_msg_get_value_by_name_with_type(msg, "PRI", &len, &type);
KeyValue *pri_attr = macros_kvlist->add_values();
pri_attr->set_key("PRI");
pri_attr->mutable_value()->set_bytes_value(value, len);
pri_attr->mutable_value()->set_int_value(msg->pri);

value = log_msg_get_value_by_name_with_type(msg, "TAGS", &len, &type);
KeyValue *tags_attr = macros_kvlist->add_values();
Expand Down
4 changes: 2 additions & 2 deletions modules/grpc/otel/otel-protobuf-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,9 @@ syslogng::grpc::otel::ProtobufParser::set_syslog_ng_macros(LogMessage *msg, cons

if (name.compare("PRI") == 0)
{
if (!_value_case_equals(msg, macro, AnyValue::kBytesValue))
if (!_value_case_equals(msg, macro, AnyValue::kIntValue))
continue;
msg->pri = log_rewrite_set_pri_convert_pri(macro.value().bytes_value().c_str());
msg->pri = macro.value().int_value();
}
else if (name.compare("TAGS") == 0)
{
Expand Down

0 comments on commit 33a5e23

Please sign in to comment.