Makers Blog
251 views 0 comments

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

./serve

To download the default logfile you can browse and the file should be downloaded in the browser.http://#IpOfController:4000/logs/default.sqlite

Note:

The Makers Blog shows applications and user stories of community members that are not tested or reviewed by Phoenix Contact. Use them at your own risk.

Discussion

Please login/register to comment

Login/Register

Leave a Reply

Newsletter
Never miss a new article
Sign up for the newsletter
Never miss news about PLCnext Technology
Get interesting content via newsletter four times a year
Receive exclusive information before all other users