WEBVTT

00:00.530 --> 00:02.990
Welcome back to the Knowledge Portal Video series.

00:03.440 --> 00:09.220
So you might hear a lot of cracker busting up in the background throughout the video.

00:09.230 --> 00:14.950
So it is Diwali today and a lot of crackers are bursting up.

00:14.960 --> 00:18.400
So happy Diwali to you all.

00:18.410 --> 00:21.080
So most of you will be watching this video later.

00:21.080 --> 00:26.180
So consider this as a futuristic message for the upcoming years.

00:27.440 --> 00:34.850
So coming back to the topic we have already discussed about the engine access log and how can we configure

00:34.850 --> 00:37.850
our own custom access log directives?

00:38.570 --> 00:45.020
Now there is a second type of log called as error log, which are very information as very informational.

00:45.020 --> 00:48.920
As far as this debugging issues are concerned.

00:49.610 --> 01:00.080
Now there are a lot of level of error logs which starts from emergency to debug, so there is no mention

01:00.180 --> 01:05.190
on what exactly each of this level of logging means.

01:05.190 --> 01:09.000
So Enginex documentation does not have that officially.

01:09.210 --> 01:15.480
So if you really want to know the exact difference, then you have to dig in through the source code

01:15.510 --> 01:18.600
to see what exactly each one of them is doing.

01:18.840 --> 01:25.560
But we will try to understand on or have an overview on what exactly this does.

01:27.630 --> 01:33.210
So let's go back to the Nginx configuration file.

01:35.370 --> 01:41.580
And here we have something called as error log directive, followed by the path in which the log to

01:41.580 --> 01:42.240
be stored.

01:43.440 --> 01:51.450
Now, as far as error log is concerned, it is very important to know that Nginx does not allow us to

01:51.450 --> 01:55.680
have the flexibility that we had with access log.

01:56.340 --> 02:00.360
That same amount of flexibility is not available for error log.

02:00.870 --> 02:06.990
So as far as error log is concerned, you cannot have any other format in which the logs will be stored.

02:06.990 --> 02:11.460
So the format is predefined and you cannot change that.

02:11.730 --> 02:19.710
The only thing that you can change maybe is the level of logging and the file in which the error log

02:19.710 --> 02:20.340
will be stored.

02:20.880 --> 02:22.320
And this is it.

02:23.520 --> 02:30.780
So let me clear the log files before we start so it will become much more better.

02:34.230 --> 02:36.720
Okay, I'll clear the access log as well.

02:39.060 --> 02:44.820
So let's open up the browser and before that let's do a tail.

02:50.720 --> 02:52.430
I'll remove the example dot log.

02:52.580 --> 02:56.660
We had configured this in the access log.

02:57.920 --> 02:59.390
Time and.

03:02.520 --> 03:02.850
Example.

03:02.940 --> 03:03.450
Dot log.

03:03.660 --> 03:10.110
Okay, let's do a tail on the logs.

03:13.970 --> 03:17.960
Okay, so currently you see the access log is empty and error log is empty.

03:18.140 --> 03:25.970
So let's open up the browser and let's create some logs specifically in the error logs.

03:25.970 --> 03:32.150
So I'll say example.com slash something which is non-existent if I press enter.

03:32.450 --> 03:35.030
And now you see an error log is generated.

03:36.170 --> 03:41.220
So let's try to understand on what can be the predetermined format for it.

03:41.240 --> 03:44.120
So the first thing is the timestamp.

03:44.120 --> 03:51.650
So this is the timestamp of the request which resulted in an error.

03:51.740 --> 03:54.590
Now this is a log level, which is error.

03:54.590 --> 03:58.550
So we have already seen that there are various types of log level.

03:58.550 --> 04:07.610
Now this log level is considered as type error followed by the log level is the process ID.

04:07.820 --> 04:16.110
Now, this process ID is the ID of the worker process, which handled this particular request.

04:19.260 --> 04:22.770
Followed by the process ID, you can see hash zero.

04:22.800 --> 04:31.860
Now, this hash zero basically means it is single threaded, so this will always remain zero because

04:31.860 --> 04:36.510
Nginx is a single threaded followed by.

04:36.540 --> 04:44.910
There is a open call for this particular file example which is not there.

04:44.910 --> 04:50.460
So it is already saying that no such file or directory followed by it is also saying the IP address

04:50.460 --> 04:52.620
of the client and the host name.

04:54.300 --> 05:00.030
So this is an overview about how an error log looks like.

05:00.060 --> 05:06.660
So as we've already discussed, that there are various types of logging, so this is of type error.

05:06.690 --> 05:12.650
Now if we go above, there are many things like emergency alert or critical.

05:12.660 --> 05:21.300
So emergency basically deals with, let's say, some kind of error in the enginex configuration due

05:21.300 --> 05:24.030
to which Nginx itself will not start.

05:24.750 --> 05:32.160
So those kind of very critical logs are termed as emergency.

05:32.610 --> 05:37.770
So let's look into what an emergency log might look like.

05:39.210 --> 05:49.560
So let's open nginx.conf and let's say we make some error in the configuration file itself.

05:49.890 --> 05:55.470
And if I try to do reload, you see Nginx itself has failed.

05:57.370 --> 06:05.800
Now, if we go into the log file here, it says this is emergency because this deals with Nginx itself

06:05.800 --> 06:07.470
not starting at all.

06:07.480 --> 06:14.950
So if Nginx itself does not start, that means if there are multiple websites within nginx all will

06:14.950 --> 06:15.970
stop working.

06:15.970 --> 06:20.650
So those type of logs are categorized as emergency.

06:21.310 --> 06:26.890
Now there is also something called as debug logs which actually provides a huge deal of information

06:26.890 --> 06:28.420
within the log files.

06:28.540 --> 06:36.790
Now debug logs by default are not enabled and you have to compile Nginx manually if you want to enable

06:36.790 --> 06:38.380
the debug log directives.

06:38.590 --> 06:43.630
So this is a short video about what a error log looks like.

06:43.750 --> 06:52.090
So as we cannot configure our own format for error log, there is not much thing that we can have in

06:52.090 --> 06:58.310
this video, so I hope this basic concept has been informative for you and I'd like to thank you for

06:58.310 --> 06:58.700
viewing.
