Skip to content

Conversation

@dehaansa
Copy link
Contributor

@dehaansa dehaansa commented Mar 25, 2022

Logs receiver for SAP HANA trace logs is relatively straightforward.

image

Below is an outdated image (source_file), but shows multiline support
image

@PhilBrammer
Copy link

Are the multi-line log entries being captured correctly?

@dehaansa
Copy link
Contributor Author

@PhilBrammer they should be. Still working on validation.

@PhilBrammer
Copy link

AFAIK, without using the multiline regex processor, I would expect each line in the multiline log to be treated as a separate log entry, to be parsed with your regex as individual lines. Recommend using LoggingProcessorParseMultilineRegex. Mysql logging implements this:

func (p LoggingProcessorMysqlGeneral) Components(tag string, uid string) []fluentbit.Component {

@dehaansa
Copy link
Contributor Author

@PhilBrammer the pattern I'm following here is the more recent pattern that we've been using (see elasticsearch, couchdb, hadoop, rabbitmq, zookeeper & wildfly). The pattern in mysql can encounter issues with with logs being separated by chunks in fluent bit and ending up not being parsed together via the multiline parser, though the pattern we're following here where the multiline is attached to the input also has potential issues (unverified) with syslog forwarding.

@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label May 31, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label May 31, 2022
@martijnvans martijnvans added the kokoro:force-run Forces kokoro to run integration tests on a CL label May 31, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label May 31, 2022
@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 1, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 1, 2022
@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 1, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 1, 2022
@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 1, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 1, 2022
@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 1, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 1, 2022
@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 24, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 24, 2022
@dehaansa dehaansa requested a review from ridwanmsharif June 24, 2022 17:05
@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 24, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 24, 2022
@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 27, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 27, 2022
Copy link
Contributor

@ridwanmsharif ridwanmsharif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo a couple of comments that need addressing.

apps/saphana.go Outdated
// 1: 0x00007f1937d9095c in .LTHUNK27.lto_priv.2256+0x558 (libhdbbasis.so)
// ...
// 25: 0x0000563f44888831 in _GLOBAL__sub_I_setServiceStarting.cpp.lto_priv.239+0x520 (hdbnsutil)
Regex: `^\[(?<thread_id>\d+)\]\{(?<connection_id>-?\d+)\}\[(?<transaction_id>-?\d+)\/(?<update_transaction_id>-?\d+)\]\s+(?<time>\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\.\d{3,6}\d+)\s+(?<severity_flag>\w+)\s+(?<component>\w+)\s+(?<source_file>\S+)\s+:\s+(?<message>[\s\S]+)`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the source_file field here, I wonder if we can use the LogEntry sourceLocation field. We have an example here:

input = append(input, fluentbit.Component{
Kind: "FILTER",
Config: map[string]string{
"Name": "nest",
"Match": tag,
"Operation": "nest",
"Wildcard": "logging.googleapis.com/sourceLocation/*",
"Nest_under": "logging.googleapis.com/sourceLocation",
"Remove_prefix": "logging.googleapis.com/sourceLocation/",
},
})
return input
}

Would be a bonus if we can reuse the modify_fields processor below but I don't see a nest option

apps/saphana.go Outdated
}

func (LoggingProcessorSapHanaTrace) Type() string {
return "saphana_trace"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there other logs that are not trace that make its way to syslog? Or that could be configured in the future?
I'm wondering why we don't just call this saphana like we do with other receivers that have only a singular input

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we can change it.

@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 27, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 27, 2022
@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 27, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 27, 2022
then
record["logging.googleapis.com/sourceLocation"] = {}
end
record["logging.googleapis.com/sourceLocation"]["line"] = value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See here. The Lua code already nests it and so the additional filter is a no-op essentially

apps/saphana.go Outdated
}.Components(tag, uid)...,
)

c = append(c, fluentbit.Component{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary is it? I believe modify_fields already nests this under sourceLocation. See the other comment for the actual LUA code that the modify creates. Certainly looks like a nesting is happening already.

@dehaansa dehaansa added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 27, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 27, 2022
@ridwanmsharif ridwanmsharif added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 28, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 28, 2022
@ridwanmsharif ridwanmsharif added the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 28, 2022
@stackdriver-instrumentation-release stackdriver-instrumentation-release removed the kokoro:force-run Forces kokoro to run integration tests on a CL label Jun 28, 2022
@ridwanmsharif
Copy link
Contributor

Looks like everything passes except for FAIL: TestThirdPartyApps/sql-std-2019-win-2019/mssql which is a known unrelated issue being investigated in b/237276968.

@ridwanmsharif ridwanmsharif merged commit 0ffec98 into GoogleCloudPlatform:master Jun 28, 2022
@dehaansa dehaansa deleted the sap-hana-logs branch June 28, 2022 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants