OK, so now we can look at the low key data source, the lucky data source is about rating locavores
from your service.
Many servers and applications will store log files in a file that you can often just read in a text
editor such as Web servers will do it.
Database servers capable of calls The Journal System Day on Linux is a good source of information that
we can also read to use it.
Lucky data source We can install two extra services that work together, both written by professional
labs.
The first one being the low key service is what we'll install in this video.
Now, the lucky service, if I go to the final lucky GitHub page is a process that will run on your
server, and it's responsible for storing logs and processing queries.
So it's a bit like an Eskimo server, but for log files.
So the Gryphon low key data source that will set up will connect to the low key process running on your
server.
Now, like it doesn't exist by itself, something needs to be pushing data into it and will use prompt
mail for that, and we'll discuss that in the next video from.
Will read log files that you've asked it to and then send them off to low key so that Loki can store
them and organize them in such a way for querying by Carafano.
Anyway, so in Gryffindor, if you go to data sources and you add a data source down here, there's
the low key data source says it's like Prometheus, but for logs.
We haven't done Prometheus yet in this course, but we will.
Anyway, before we can use that data source, we need to set up a service that the Likee data source
will connect to.
Similar to what we did when we set up my school.
OK, so back at this diagram, we're now going to install low key service locally on the Gravano server.
So from the perspective of the Karana application, the Loki service will be at one 20 seven zero zero
one, which is the same as local host.
OK, so all my documentation down here we can install the Loki binary.
We'll set that up and that's these instructions here.
So log on to your profile and a server.
I'm now a microphone, a server root at Safana there, and I'm going to change to a folder usr local
bin.
So that's where I'll install the Loki binary.
So city use local bin, I'm down usr local bin folder.
I'm now going to download using kernel a zip file containing the Loki binary and dirty version two point
four point one.
Now, Loki is like a Farner.
It is updated regularly, but if you want to see what the latest version is, you can visit that link
there.
It takes you to the Crafar Loki repository, the releases page, and I can see two point four point
one, so we will install that, so copy that whole line.
I'm going to just copy that.
The clipboard is net icon now.
Right click Enter.
OK, so it's just downloaded the Loki Linux AMD64 zip and saved it into the user local bin folder.
OK, for this type, less will sit there, then we have to unzip it.
So unzip Loki won't accept a 64.
I don't have unzip on my computer.
I can install that quickly just by highlighting that right clicking and into I could have just typed
on the keyboard.
It's run that unzip again.
So I was pressing the up arrow because it shows me what I typed in previously.
So unzip hey.
Inflating lists.
There are two files now.
Loki likes AMD64 and Loki, Linus and 64.
So if I do less l'hygiene, it shows me that that file there has executed permissions.
So this is good.
Sometimes they don't have X permissions.
If they don't, you can just run C mode.
A-plus takes the name of the file and it will show you file as being executable.
It's important that the file was executable and it already is for us.
So this is previously in all the versions of Loki.
You would have to manually make that file executable and that's why I have that amount of documentation
still just in case.
OK, so before we can start Loki, we need to do several things.
One of those is to create a config false, so it's quite a config file using nano.
So I was going to copy that line there.
Ciudadano config Loki.
Why?
OK, so then I opened up a blank page and it's already clear that fall for us, but there's nothing
in.
So let's put something in a copy this text below or just press that icon.
And if I right click it pasted all into and then our editor there.
Now this is a default Loki configuration.
I'm using version two point for one, and I got that from this official Bafana Loki link here on GitHub
for using a newer version and two point four point one.
Be sure to check that link to see if there's anything different in the configuration file.
That's if you have problems.
So just in case.
OK, so back to nano, it's saved that.
So Control X saved modified by thought yes.
So I'm pressing Y for yes presenter.
Very good.
If I press Ellis now, there are three false sets.
The configuration is the Loki binary, which is executable and the zip file.
We no longer need a zip file, but I'll just leave it there anyway so we can start Loki now.
But it's not really a good idea because if we close our society session, the Loki service will stop.
So what we should do is set it up to run as a service so that it continues to run in the background
because we wanted to run 24 hours a day.
So what I'm going to do is create a system user called Loki.
So copy that and that will be the user that will run the Loki process.
Sudo add system Loki.
And so I'm now going to create a file called Loki Service Copy that using nano again ciudadano ATC System
D System Loki Service Press Enter.
OK, so send, you know, empty file.
Is full force and in that paste this text.
This allows our low key Linux aimed big fall that we just created to run as a background service on
our server.
And that's the configuration file that is using usr local bin config Loki or just move the cursor along
there will see that it's config Loki dot.
Why email?
Excellent.
Or so you'll see that it's using a user.
Loki we discovered that user control.
Yes.
And so we can now start stop Loki using these commands.
So sudo service Loki start.
OK, we can check its status and its active running.
So to go.
Loki is now running as a service on my Crafar server.
I could always stop it if I wanted to.
I'm not going to do that, but you can if you need to.
Now, since we have Loki running, we cannot connect to that using Gafah.
I'm already on the data source configuration page.
I'm going to select Loki.
Let me get the name Loki.
That's a good name.
We're going to connect to local host 3100, or you could even use one 20 seven zero zero one three one
two and it's takes TTP.
And that's from the perspective of our phone replication.
So it's just another service running on the same server, listening on Port 3100.
OK, so save and test data source connected and Labor's found.
Excellent.
We don't have any data inside Loki yet because we haven't set up pronto.
We'll do that in the next video, but for now, we can at least go into the Explore tab and we can select
it from the top down.
Then Loki no logs found.
It doesn't matter.
We'll get on to that now.
One thing to note there I'm using the digitalisation service, so I don't have a default firewall locking
ports so I can actually access that Loki service across the internet.
And that address is HTP.
Fernando Espaco Dot Net Calling 3-1-1.
Loki is listening on Port 100, but it's also accessible across the internet for me, so that would
be your domain name if you use a domain name or your Cortana service IP address.
That is my one.
So if I press that I can see that there is actually a web server running there because this would turn
to for if that's what web servers do.
But if you just type splash metrics, it would turn this data, which are statistics about the Loki
service.
Now you probably don't want that to be exposed on the internet like that.
If you're using it was security group won't have 3100 open already.
But since I'm using an unrestricted Ubuntu server and I don't have a dedicated firewall, I'm going
to block Port 3100 using IP tables.
So that's down here.
IP tables.
I'm going to accept 3100 on local host only because the Raphinha's service needs to still query the
Loki service.
So about Mega-fauna server doesn't matter what forum and IP tables in port TCP local host destination
Port 3100 Except until now, I'm going to drop everything else, so no other IP address will be able
to connect to port three 100 IP tables in Port TCP, IP or 100 drop, and that line means drop everything
else.
I can verify that IP tables often now and they are my rules.
Okay, so accepting local hosts three 100 dropping everything else.
Okay, so excellent.
We have the Loki service running on our server.
Another thing it's also exposing Port nine zero nine six.
It uses that for your PC communications for internal management.
OK, so that port is also going to be accessible across the internet.
If you're using a similar set up to me, for example, I'm on my windows machine and I have a program
called Telnet installed and I can tell it to father daughter speak code dot net.
Port, nine hour, nine, six.
And we can see that it's actually connected, so I'm going to close that port as well.
It's great that by closing it, so in my documentation, I've read the rules here to allow nine nine
six on local host.
So I'm accepting source local host destination port nine and on six, that's OK, but dropping everything
else, and I'll just verify that.
So I would go so excepting 1996 from local hosts and dropping everywhere else.
OK, so another tool that you can use to check what Porter service is using is the SS Command on Ubuntu
twenty one, zero four and above.
It's very similar to the old netstat command.
Here I'm going to return results with the word Lokey in them, so enter that here.
It's word wraps, so it's quite hard to say, but you can see that the low key Linux I am d is using
Port 99, six and three 100.
OK, so if you're going to have these services running on your servers, you will need to ensure that
they're not exposing information accidentally.
OK, excellent.
And also, be sure to read my information on keeping rules persistent if you're using IP tables.
I'm going to create a backup of my IP tables rules now.
I'm only using IP version four, so I need to run that one.
Excellent.
So the next video will set up the prompt health service to read log falls.
Excellent.