WEBVTT

00:00.140 --> 00:00.590
Hey, everyone.

00:00.590 --> 00:01.570
And welcome back.

00:01.580 --> 00:05.930
Now in today's video, we will be discussing about the httpcontext.

00:05.960 --> 00:12.740
Now, just to revise the Httpcontext basically contains the required directives that defines on how

00:12.740 --> 00:18.080
to handle the Http or Https connections and its associated parameters.

00:18.080 --> 00:24.710
So if you look into this Http context block here you have various directives like include log format,

00:24.710 --> 00:28.760
access, log Keepalive, GZip, and so many others.

00:28.760 --> 00:34.760
So in today's video, what we'll be doing, we will primarily be exploring two of these important directives.

00:34.760 --> 00:39.260
First one is the access log and second one is the log underscore format.

00:39.290 --> 00:47.120
Now currently within the Nginx.conf file, if we look into the Http context block here, first important

00:47.120 --> 00:49.070
part here is the access log file.

00:49.070 --> 00:54.050
And basically here you have the path where the access log will be stored.

00:54.050 --> 00:55.130
So let's do one thing.

00:55.130 --> 00:58.130
Let's look into what exactly this log file contains.

00:58.130 --> 01:05.580
So I'll do a list on var log Nginx access dot log, let's press enter.

01:05.580 --> 01:12.120
And here you see that there are multiple logs associated with the request that were made to the Nginx

01:12.120 --> 01:12.900
web server.

01:12.900 --> 01:15.810
Now let's do one thing instead of less.

01:15.840 --> 01:20.340
Let's quickly do a tail hyphen f on this specific file.

01:20.520 --> 01:26.610
Now, at this specific moment, you see that there are no new requests that are coming now from a new

01:26.640 --> 01:27.660
igniter window.

01:27.660 --> 01:34.890
Let me go ahead and paste the IP address of the server and as expected, a default Nginx page got loaded

01:35.040 --> 01:36.990
and corresponding to it.

01:37.020 --> 01:40.710
Here you will see that you also have a specific access log.

01:40.710 --> 01:44.280
Now this specific log request has a format.

01:44.280 --> 01:48.000
So if you look into the format first it is showing us the IP address.

01:48.000 --> 01:52.320
Then it is showing us the timestamp where the request was made.

01:52.320 --> 01:54.150
Then it is showing us the get.

01:54.180 --> 02:00.270
Then it is also showing us details associated with the chrome and the version and various others.

02:00.270 --> 02:03.300
So that is what the access log is all about.

02:03.300 --> 02:10.320
Now the format based on which the actual log is stored is specified in the log underscore format.

02:10.350 --> 02:16.860
Now you might be wondering why it is showing the IP address of the user who has made the request first

02:16.860 --> 02:22.200
and the reason why it is showing it as a first part is because of this specific log format.

02:22.200 --> 02:28.560
Within this log format, it is defined that the remote ID, which is nothing but the IP address of the

02:28.560 --> 02:32.640
remote client, should be the first part of the log request.

02:32.640 --> 02:35.250
Then you also have the timestamp.

02:35.250 --> 02:39.660
So here you see, you have the timestamp and this is the reason why you have a timestamp here.

02:39.660 --> 02:45.090
And then you have various things like request status, body bytes, then you have the Http referrer

02:45.090 --> 02:46.380
user agent and so on.

02:46.380 --> 02:50.940
And based on this, the specific log is generated accordingly.

02:50.940 --> 02:55.560
So again, do note that we have just discussed about this at a very high level overview.

02:55.560 --> 03:02.160
Whenever required, we'll be discussing in great detail associated with the log underscore format directive

03:02.160 --> 03:07.500
and how we can modify it based upon our requirements in the later sections of this course.

03:07.500 --> 03:09.930
So with this, we'll conclude today's video.
