Welcome back to the Knowledge Portal Video series.
So you might hear a lot of cracker busting up in the background throughout the video.
So it is Diwali today and a lot of crackers are bursting up.
So happy Diwali to you all.
So most of you will be watching this video later.
So consider this as a futuristic message for the upcoming years.
So coming back to the topic we have already discussed about the engine access log and how can we configure
our own custom access log directives?
Now there is a second type of log called as error log, which are very information as very informational.
As far as this debugging issues are concerned.
Now there are a lot of level of error logs which starts from emergency to debug, so there is no mention
on what exactly each of this level of logging means.
So Enginex documentation does not have that officially.
So if you really want to know the exact difference, then you have to dig in through the source code
to see what exactly each one of them is doing.
But we will try to understand on or have an overview on what exactly this does.
So let's go back to the Nginx configuration file.
And here we have something called as error log directive, followed by the path in which the log to
be stored.
Now, as far as error log is concerned, it is very important to know that Nginx does not allow us to
have the flexibility that we had with access log.
That same amount of flexibility is not available for error log.
So as far as error log is concerned, you cannot have any other format in which the logs will be stored.
So the format is predefined and you cannot change that.
The only thing that you can change maybe is the level of logging and the file in which the error log
will be stored.
And this is it.
So let me clear the log files before we start so it will become much more better.
Okay, I'll clear the access log as well.
So let's open up the browser and before that let's do a tail.
I'll remove the example dot log.
We had configured this in the access log.
Time and.
Example.
Dot log.
Okay, let's do a tail on the logs.
Okay, so currently you see the access log is empty and error log is empty.
So let's open up the browser and let's create some logs specifically in the error logs.
So I'll say example.com slash something which is non-existent if I press enter.
And now you see an error log is generated.
So let's try to understand on what can be the predetermined format for it.
So the first thing is the timestamp.
So this is the timestamp of the request which resulted in an error.
Now this is a log level, which is error.
So we have already seen that there are various types of log level.
Now this log level is considered as type error followed by the log level is the process ID.
Now, this process ID is the ID of the worker process, which handled this particular request.
Followed by the process ID, you can see hash zero.
Now, this hash zero basically means it is single threaded, so this will always remain zero because
Nginx is a single threaded followed by.
There is a open call for this particular file example which is not there.
So it is already saying that no such file or directory followed by it is also saying the IP address
of the client and the host name.
So this is an overview about how an error log looks like.
So as we've already discussed, that there are various types of logging, so this is of type error.
Now if we go above, there are many things like emergency alert or critical.
So emergency basically deals with, let's say, some kind of error in the enginex configuration due
to which Nginx itself will not start.
So those kind of very critical logs are termed as emergency.
So let's look into what an emergency log might look like.
So let's open nginx.conf and let's say we make some error in the configuration file itself.
And if I try to do reload, you see Nginx itself has failed.
Now, if we go into the log file here, it says this is emergency because this deals with Nginx itself
not starting at all.
So if Nginx itself does not start, that means if there are multiple websites within nginx all will
stop working.
So those type of logs are categorized as emergency.
Now there is also something called as debug logs which actually provides a huge deal of information
within the log files.
Now debug logs by default are not enabled and you have to compile Nginx manually if you want to enable
the debug log directives.
So this is a short video about what a error log looks like.
So as we cannot configure our own format for error log, there is not much thing that we can have in
this video, so I hope this basic concept has been informative for you and I'd like to thank you for
viewing.