AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Ip2location lite db1 bin12/8/2023 ![]() The above code read all Apache log data from the input, then process them recursively line by line and run the ip2location command to retrieve the countryshort information. #appending tab to recreate the apache log stringįor item in prepend country code data to the apache string ![]() This command assume the db1.bin file located at the same folder of this scriptĬountry_code="$(ip2location -datafile IP2LOCATION-LITE-DB1.BIN -ip $ -noheading -field countryshort -format TAB)" Copy the following code and paste into the add-country-code.sh.Create a bash script to prepend and named it as add-country-code.sh.Unzip the file and you shall get the IP2LOCATION-LITE-DB1.BIN file in the folder.However, for this tutorial, I will going to use the IP2Location DB1.LITE for the tutorial in case you have no access to the commercial version.ĭownload the DB1.LITE using the below command wget I will recommend you to use the commercial IP2Location DB1 package as it provides you high data accuracy. Download the IP2Location DB1 data file.Run the below commands to install the IP2Location application cd ip2location-7.0.0.You may also visit to find out the details. You can download the application using the below command. You need to install the IP2Location application.For example, to display FR in front of 5.196.143.10 data row.īelow are the steps to produce the above result: To prepend with the country code information. For this, we are going to use IP2Location application to get the country code information for display together with Apache log information.īasically for this tutorial, we are going to turn the below Apache log display (using tail command) The log provides you lots of useful information, such as IP address, useragent, HTTP status, and so on, but not for the country code information. Apache log is a great resource that you can use it to study the traffics connected to your Apache server. Are you looking for solution to display country code along with Apache log information for your analysis? This tutorial is going to shed you some lights on how to accomplish it.
0 Comments
Read More
Leave a Reply. |