Skip to content

Testing log4j 1.17 socket appender, can only parse the first document #7

@ICHx

Description

@ICHx

Hi,
I'm glad I found this library to experiment with.

I am using the library to try reading log4j logging event. I read the connection with bufio.NewReader then fed to jserial.NewSerializedObjectParser(r)

While single item worked well, if I am trying to send multiple events at once, ie. having 2 log.debug("Hello"); in the file below, it would fail to parse anything other than the first document.

logstash-input-log4j tester

I tried peeking it, while I have EOF error, it clearly still have data behind the EOF.

Here is the log.

2023/03/07 10:21:27 Peeked: [4 109 97 105 110 112 119 4 0 0 39 16 112 120 121]
2023/03/07 10:21:27 Error parsing object: [] error reading uint16: EOF
2023/03/07 10:21:27 Error peeking reader: EOF
2023/03/07 10:21:27 Peeked: []
2023/03/07 10:21:27 Received unserialized content:
 {"@":["AAAnEA==",null],"categoryName":"sender","class":{},"extends":{"org.apache.log4j.spi.LoggingEvent":{"@":["AAAnEA==",null],"categoryName":"sender","locationInfo":null,"mdcCopy":null,"mdcCopyLookupRequired":false,"ndc":null,"ndcLookupRequired":false,"renderedMessage":"Hello","threadName":"main","throwableInfo":null,"timeStamp":1678155687937}},"locationInfo":null,"mdcCopy":null,"mdcCopyLookupRequired":false,"ndc":null,"ndcLookupRequired":false,"renderedMessage":"Hello","threadName":"main","throwableInfo":null,"timeStamp":1678155687937}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions