PLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community


 How to create a Blog Entry

Serving static files with Go

The embedded datalogger is a wonderful tool to create databases of your process-data. The Notification manager and logger on the other hand is perfect to log user-actions or specific events. You can create your own notifications by modifying the example on GitHub.

In development or even sometimes in production you don't want to struggle with logging in to the sFTP server and copying the files every time you wan't to check your data or new logs. This blog will show you how to create a static file-server with GoLang to serve the files you need by simply browsing the right URI.

More information about using Go on PLCnext can be found in a previous blog entry.  In this blog we'll use only one command to build our code for the AXC F 1152 or AXC F 2152.

The source-code for our fileserver is rather short and can be found here.

Copy the sourcefile to your development machine and open a terminal. Browse to the right directory and run the following command.

env GOOS=linux GOARCH=arm GOARM=7 go build serve.go

You should get a new file, this new file is our fileserver!

Copy the file to the controller via WinSCP and open a SSH connection.
Make the file (binary) executable with

chmod +x serve

and start the fileserver with


To download the default logfile you can browse and the file should be downloaded in the browser.