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

Syslog receiver returns string attribute instead of map #27414

Closed
sumo-drosiek opened this issue Oct 3, 2023 · 3 comments
Closed

Syslog receiver returns string attribute instead of map #27414

sumo-drosiek opened this issue Oct 3, 2023 · 3 comments
Labels
bug Something isn't working receiver/syslog

Comments

@sumo-drosiek
Copy link
Member

sumo-drosiek commented Oct 3, 2023

Component(s)

receiver/syslog

What happened?

Description

Syslog receiver produces attribute (structured_data) which is a stringified map:

Body: Str(<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] BOMAn application event log entry..)
Attributes:
     -> hostname: Str(mymachine.example.com)
     -> priority: Int(165)
     -> msg_id: Str(ID47)
     -> message: Str(BOMAn application event log entry..)
     -> facility: Int(20)
     -> appname: Str(evntslog)
     -> structured_data: Str(map[exampleSDID@32473:map[eventID:1011 eventSource:Application iut:3]])
     -> version: Int(1)

Steps to Reproduce

~ cat input.txt 
<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] BOMAn application event log entry..
➜  ~ nc localhost 54525 < input.txt

Expected Result

Body: Str(<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] BOMAn application event log entry..)
Attributes:
     -> priority: Int(165)
     -> hostname: Str(mymachine.example.com)
     -> version: Int(1)
     -> appname: Str(evntslog)
     -> message: Str(BOMAn application event log entry..)
     -> structured_data: Map({"exampleSDID@32473":{"eventID":"1011","eventSource":"Application","iut":"3"}})
     -> facility: Int(20)
     -> msg_id: Str(ID47)

Actual Result

Body: Str(<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] BOMAn application event log entry..)
Attributes:
     -> hostname: Str(mymachine.example.com)
     -> priority: Int(165)
     -> msg_id: Str(ID47)
     -> message: Str(BOMAn application event log entry..)
     -> facility: Int(20)
     -> appname: Str(evntslog)
     -> structured_data: Str(map[exampleSDID@32473:map[eventID:1011 eventSource:Application iut:3]])
     -> version: Int(1)

Collector version

b5e9e5e

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

receivers:
  syslog/client:
    protocol: rfc5424
    tcp:
      listen_address: '0.0.0.0:54525'
exporters:
  logging:
    verbosity: detailed
service:
  pipelines:
    logs/client:
      receivers:
        - syslog/client
      exporters:
        - logging

Log output

./bin/otelcontribcol_linux_amd64 --config local/syslog.yaml
2023-10-03T20:36:37.933+0200    info    service@v0.86.0/telemetry.go:84 Setting up own telemetry...
2023-10-03T20:36:37.933+0200    info    service@v0.86.0/telemetry.go:201        Serving Prometheus metrics      {"address": ":8888", "level": "Basic"}
2023-10-03T20:36:37.933+0200    info    exporter@v0.86.0/exporter.go:275        Deprecated component. Will be removed in future releases.       {"kind": "exporter", "data_type": "logs", "name": "logging"}
2023-10-03T20:36:37.935+0200    info    service@v0.86.0/service.go:138  Starting otelcontribcol...      {"Version": "0.86.0-dev", "NumCPU": 16}
2023-10-03T20:36:37.935+0200    info    extensions/extensions.go:31     Starting extensions...
2023-10-03T20:36:37.935+0200    info    adapter/receiver.go:45  Starting stanza receiver        {"kind": "receiver", "name": "syslog/client", "data_type": "logs"}
2023-10-03T20:36:37.935+0200    info    service@v0.86.0/service.go:161  Everything is ready. Begin running and processing data.
2023-10-03T20:36:40.537+0200    info    LogsExporter    {"kind": "exporter", "data_type": "logs", "name": "logging", "resource logs": 1, "log records": 1}
2023-10-03T20:36:40.537+0200    info    ResourceLog #0
Resource SchemaURL: 
ScopeLogs #0
ScopeLogs SchemaURL: 
InstrumentationScope  
LogRecord #0
ObservedTimestamp: 2023-10-03 18:36:40.481984234 +0000 UTC
Timestamp: 2003-10-11 22:14:15.003 +0000 UTC
SeverityText: notice
SeverityNumber: Info2(10)
Body: Str(<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] BOMAn application event log entry..)
Attributes:
     -> hostname: Str(mymachine.example.com)
     -> priority: Int(165)
     -> msg_id: Str(ID47)
     -> message: Str(BOMAn application event log entry..)
     -> facility: Int(20)
     -> appname: Str(evntslog)
     -> structured_data: Str(map[exampleSDID@32473:map[eventID:1011 eventSource:Application iut:3]])
     -> version: Int(1)
Trace ID: 
Span ID: 
Flags: 0
        {"kind": "exporter", "data_type": "logs", "name": "logging"}
^C2023-10-03T20:36:43.202+0200  info    otelcol@v0.86.0/collector.go:250        Received signal from OS {"signal": "interrupt"}
2023-10-03T20:36:43.202+0200    info    service@v0.86.0/service.go:170  Starting shutdown...
2023-10-03T20:36:43.202+0200    info    adapter/receiver.go:139 Stopping stanza receiver        {"kind": "receiver", "name": "syslog/client", "data_type": "logs"}
2023-10-03T20:36:43.202+0200    error   tcp/tcp.go:286  Scanner error   {"kind": "receiver", "name": "syslog/client", "data_type": "logs", "operator_id": "syslog_input_internal_tcp", "operator_type": "tcp_input", "error": "read tcp 127.0.0.1:54525->127.0.0.1:33738: use of closed network connection"}
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/input/tcp.(*Input).goHandleMessages.func1
        github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza@v0.86.0/operator/input/tcp/tcp.go:286
2023-10-03T20:36:43.202+0200    info    extensions/extensions.go:45     Stopping extensions...
2023-10-03T20:36:43.202+0200    info    service@v0.86.0/service.go:184  Shutdown complete.

Additional context

No response

@sumo-drosiek sumo-drosiek added bug Something isn't working needs triage New item requiring triage labels Oct 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2023

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@sumo-drosiek
Copy link
Member Author

Here is an attempt to fix it

djaglowski pushed a commit that referenced this issue Oct 4, 2023
…7415)

**Description:**

Syslog receiver produces attribute (`structured_data`) which is a
stringified map. This PR fixes it. See Issue for more details

**Link to tracking Issue:**
#27414

**Testing:**

UT

**Documentation:**

In code comments

---------

Signed-off-by: Dominik Rosiek <drosiek@sumologic.com>
@crobert-1
Copy link
Member

Thanks for resolving @sumo-drosiek! I'm closing as fixed, but please let me know if there's something I missed here.

@crobert-1 crobert-1 removed the needs triage New item requiring triage label Oct 5, 2023
jorgeancal pushed a commit to jorgeancal/opentelemetry-collector-contrib that referenced this issue Oct 9, 2023
…en-telemetry#27415)

**Description:**

Syslog receiver produces attribute (`structured_data`) which is a
stringified map. This PR fixes it. See Issue for more details

**Link to tracking Issue:**
open-telemetry#27414

**Testing:**

UT

**Documentation:**

In code comments

---------

Signed-off-by: Dominik Rosiek <drosiek@sumologic.com>
jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this issue Nov 12, 2023
…en-telemetry#27415)

**Description:**

Syslog receiver produces attribute (`structured_data`) which is a
stringified map. This PR fixes it. See Issue for more details

**Link to tracking Issue:**
open-telemetry#27414

**Testing:**

UT

**Documentation:**

In code comments

---------

Signed-off-by: Dominik Rosiek <drosiek@sumologic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working receiver/syslog
Projects
None yet
Development

No branches or pull requests

2 participants