Save your game's logs using Logtail

Save your game’s logs using Logtail

Have you ever wanted to keep your logs from your game somewhere you can view them quick and easy? If yes, me too. I made this quick and easy module to allow you to save your logs in a service called Logtail.

Signing up for Logtail

The first step is to sign up for Logtail. To start, visit logtail.com and press Sign Up in the top right hand corner.

signup

It will then ask you for your email. It says work email but you do not need to use a work email, any old email is fine.

image

You then need to click on the magic link in the inbox of the email that you used to sign up to continue. Remember to check your spam or junk folders.

After you have clicked on the link, you will be asked for some personal information.

For the website and company columns, you can use whatever you’d like, as seen in the picture, although I do not recommend it. For the ‘How did you find out about us?’ dropdown, just pick Other. Finally, click continue.

Creating the source

Now that you are in, go ahead and press ‘Connect source’ button on the top right of the ‘Sources’ page. You should already be there.

Set the name to the name of your game, and the platform to HTTP.

Then click on Create source.

Downloading the module

Download the module right here:
Logger.rbxm (988 Bytes)

Then, you can place your module inside of ServerStorage. (as it is a server only module)

Using the module

Now that you have the module, you can start to use it. Create a new script in ServerScriptService and import the Logger module.

-- ServerScriptService

local LoggerModule = require(game:GetService("ServerStorage").Logger)

Now you need to grab the source token from Logtail. Click on it to copy it.

Now go back to Roblox and register the module with that token. You can also now start using the module, by using LogService.

-- ServerScriptService

local LoggerModule = require(game:GetService("ServerStorage").Logger)
local Logger = LoggerModule:Register("YOUR_TOKEN")

local LogService = game:GetService("LogService")

LogService.MessageOut:Connect(function(message)
	Logger:Ingest(message)
end)

It should now be logging things! Go back to Logtail and visit the ‘Live tail’ page to see your logs. Click on them to expand them for more details.

Notice:

Logtail only has log retention (how long you can see the logs before they are deleted) for THREE DAYS, unless you upgrade to a paid plan.

13 Likes