How to distinguish between Linux and Windows in the filebeat code?

I read the filebeat source, and read the filebeat have multiple versions, I would like to ask how to distinguish file and how Linux and Windows operating system, how to distinguish between 32-bit system and 64-bit system?

It depends.

On can distinguish OS and architecture by conditional compilation. For some intro have a look at:

A many used packages (from stdlib) have a unified interface and use conditional compilation -> no special handling required in filebeat.

Sometimes it's easier just to dynamically check. One can use runtime.GOOS to check if the binary is running on windows.

Your answer solved my question, thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.