Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch_event_serialize_json wrongly formatting numeric fields #2650

Open
guillebot opened this issue Nov 26, 2024 · 0 comments
Open

switch_event_serialize_json wrongly formatting numeric fields #2650

guillebot opened this issue Nov 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@guillebot
Copy link

Describe the bug
I'm using https://github.com/voiceip/mod_event_kafka, which takes its input from switch_event_serialize_json.

Currently the numeric fields in json output are being formatted like this:

{
    "Event-Name": "HEARTBEAT",
    "Core-UUID": "58e0f252-0bdf-49b4-ac6a-5f4426f09288",
    "Hostname": "mss",
    "Switchname": "REDACTED",
    "IPv4": "REDACTED",
    "IPv6": "::1",
 ...
    "Uptime-msec": "329520203",
    "Session-Count": "0",
    "Max-Sessions": "1000",
    "Session-Per-Sec": "30",
    "Session-Per-Sec-Last": "0",
    "Session-Per-Sec-Max": "2",
    "Session-Per-Sec-FiveMin": "0",
    "Session-Since-Startup": "19",
    "Session-Peak-Max": "2",
    "Session-Peak-FiveMin": "0",
    "Idle-CPU": "97.866667"
}

As per RFC7159 (https://datatracker.ietf.org/doc/html/rfc7159), numeric fields shouldn't have any delimiters.

This is how this message should look like:

{
    "Event-Name": "HEARTBEAT",
    "Core-UUID": "58e0f252-0bdf-49b4-ac6a-5f4426f09288",
    "Hostname": "mss",
    "Switchname": "REDACTED",
    "IPv4": "REDACTED",
    "IPv6": "::1",
    "Event-Date-Local": "2024-11-26 08:22:53",
    "Event-Date-GMT": "Tue, 26 Nov 2024 13:22:53 GMT",
    "Event-Date-Timestamp": "1732627373411029",
    "Event-Calling-File": "switch_core.c",
    "Event-Calling-Function": "send_heartbeat",
    "Event-Calling-Line-Number": 95,
    "Event-Sequence": 41499,
    "Event-Info": "System Ready",
    "Up-Time": "0 years, 3 days, 19 hours, 32 minutes, 0 seconds, 203 milliseconds, 442 microseconds",
    "Version": "1.10.13-dev+git~20241105T191229Z~ee7c7dea60~64bit",
    "Uptime-msec": 329520203,
    "Session-Count": 0,
    "Max-Sessions": 1000,
    "Session-Per-Sec": 30,
    "Session-Per-Sec-Last": 0,
    "Session-Per-Sec-Max": 2,
    "Session-Per-Sec-FiveMin": 0,
    "Session-Since-Startup": 19,
    "Session-Peak-Max": 2,
    "Session-Peak-FiveMin": 0,
    "Idle-CPU": 97.866667
}

To Reproduce
Enable log to kafka

Expected behavior
Well formated json

thanks a lot

@guillebot guillebot added the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant