Rack of Ethernet switches.

Visualizing Log Patterns with Color

Nginx and Apache Logs in Color

Web server logs reveal patterns of activity by web crawlers. Some are indexing crawlers operated by search engines, some are mysterious. Another pattern is systematic blind searches for vulnerable server-side executables or other configuration problems. The pattern you want to see is the interested user who follows some path through the hyperlinks on your site, taking time to read the pages.

Maybe we could use color to help spot these patterns?

Maybe...

First, let's look at the result, then the explanation comes later. Here are the most recent client requests, starting most recent first. Your request for this page won't appear there as it isn't complete by the time this page was automatically generated with PHP. But if you reload the page you should see your initial request near the top.

18.191.181.47 US, United States 10/Mar/2025:07:12:58 /open-source/rsync.html
157.55.39.50 US, United States 10/Mar/2025:07:12:48 /open-source/nginx-openssl-quantum-safe/
200.24.157.208 EC, Ecuador 10/Mar/2025:07:12:23 /travel/bulgaria/veliko-tarnovo/
3.145.120.60 US, United States 10/Mar/2025:07:12:05 /open-source/
3.145.120.60 US, United States 10/Mar/2025:07:12:05 /open-source/getting-started.html
3.128.204.166 US, United States 10/Mar/2025:07:11:56 /open-source/
18.190.253.90 US, United States 10/Mar/2025:07:11:54 /travel/romania/
13.58.136.149 US, United States 10/Mar/2025:07:11:38 /open-source/external-disk/
3.234.232.67 US, United States 10/Mar/2025:07:11:24 /
13.58.219.89 US, United States 10/Mar/2025:07:11:10 /open-source/package-management.html
51.222.253.6 FR, France 10/Mar/2025:07:11:08 /open-source/python-social-media-automation/?s=mb
206.204.3.183 US, United States 10/Mar/2025:07:11:08 /travel/greece/patmos/cave-of-the-apocalypse.html
152.39.143.217 US, United States 10/Mar/2025:07:11:08 /robots.txt
204.15.208.41 Unknown 10/Mar/2025:07:11:07 /travel/greece/patmos/cave-of-the-apocalypse.html
54.80.70.69 US, United States 10/Mar/2025:07:11:06 /travel/greece/patmos/cave-of-the-apocalypse.html
14.153.240.194 CN, China 10/Mar/2025:07:10:37 /travel/uk/scapa-flow/
54.175.74.27 US, United States 10/Mar/2025:07:10:07 /
18.221.74.219 US, United States 10/Mar/2025:07:10:05 /cybersecurity/yubikey/pam_pkcs11.html
173.67.12.115 US, United States 10/Mar/2025:07:09:52 /blog/2023/01/03-whats-up-with-my-social-media.html
173.67.12.115 US, United States 10/Mar/2025:07:09:52 /
54.158.165.152 US, United States 10/Mar/2025:07:09:41 /travel/france/jim-morrison-paris.html
3.142.236.56 US, United States 10/Mar/2025:07:09:39 /cybersecurity/stack-hardening.html
129.3.170.148 US, United States 10/Mar/2025:07:09:37 /travel/france/jim-morrison-paris.html
34.96.44.128 US, United States 10/Mar/2025:07:09:30 /
74.119.118.23 US, United States 10/Mar/2025:07:09:24 /travel/greece/patmos/cave-of-the-apocalypse.html
54.209.60.63 US, United States 10/Mar/2025:07:09:24 /travel/greece/patmos/cave-of-the-apocalypse.html
68.146.224.116 CA, Canada 10/Mar/2025:07:09:22 /travel/greece/patmos/cave-of-the-apocalypse.html
57.154.175.7 BE, Belgium 10/Mar/2025:07:09:07 /open-source/performance-tuning/disks.html
57.154.175.7 BE, Belgium 10/Mar/2025:07:09:07 /robots.txt
3.138.181.188 US, United States 10/Mar/2025:07:09:01 /travel/usa/new-york-phone-booths/
50.112.178.77 US, United States 10/Mar/2025:07:09:00 /travel/usa/new-york-phone-booths/
54.245.55.85 US, United States 10/Mar/2025:07:09:00 /travel/usa/new-york-phone-booths/
43.249.25.106 CN, China 10/Mar/2025:07:08:57 /
177.55.195.158 BR, Brazil 10/Mar/2025:07:08:50 /cybersecurity/crypto/culture.html
52.22.66.203 US, United States 10/Mar/2025:07:08:44 /blog/2022/08/05-why-the-command-line-rules.html
3.17.177.41 US, United States 10/Mar/2025:07:08:27 /open-source/virtualbox-build.html
5.102.173.71 GB, United Kingdom 10/Mar/2025:07:08:10 /travel/france/
103.165.81.166 Unknown 10/Mar/2025:07:08:01 /
74.98.166.110 US, United States 10/Mar/2025:07:07:55 /blog/2023/01/03-whats-up-with-my-social-media.html
51.222.253.13 FR, France 10/Mar/2025:07:07:45 /open-source/google-freebsd-tls/freebsd.html?s=mc
173.67.12.115 US, United States 10/Mar/2025:07:07:34 /blog/2023/01/03-whats-up-with-my-social-media.html
111.225.149.67 CN, China 10/Mar/2025:07:07:29 /travel/uk/orkney-neolithic/knowe-of-onston.html
74.98.166.110 US, United States 10/Mar/2025:07:07:17 /blog/2023/01/03-whats-up-with-my-social-media.html
74.98.166.110 US, United States 10/Mar/2025:07:07:15 /
65.109.234.6 US, United States 10/Mar/2025:07:07:14 /blog/2023/01/03-whats-up-with-my-social-media.html
65.109.234.6 US, United States 10/Mar/2025:07:07:13 /
18.222.167.75 US, United States 10/Mar/2025:07:06:48 /open-source/python-social-media-automation/
40.77.167.27 US, United States 10/Mar/2025:07:06:39 /oliver-cromwell/
14.155.228.158 CN, China 10/Mar/2025:07:06:24 /oliver-cromwell/
57.128.95.181 BE, Belgium 10/Mar/2025:07:05:41 /travel/japan/kofun/?s=mb
3.208.154.201 US, United States 10/Mar/2025:07:05:38 /ads.txt
185.191.171.14 MD, Moldova, Republic of 10/Mar/2025:07:04:40 /open-source/lvm-rescue-boot.html
18.219.40.140 US, United States 10/Mar/2025:07:04:37 /open-source/raspberry-pi/hardware.html
47.82.9.42 US, United States 10/Mar/2025:07:04:36 /
81.49.156.87 FR, France 10/Mar/2025:07:04:24 /travel/france/saint-denis/?s=mb
51.222.253.1 FR, France 10/Mar/2025:07:04:02 /sitemap.txt
192.133.77.18 US, United States 10/Mar/2025:07:03:54 /travel/japan/tokyo-asakusa/sushi-train.html
192.133.77.18 US, United States 10/Mar/2025:07:03:54 /robots.txt
192.133.77.14 US, United States 10/Mar/2025:07:03:54 /robots.txt
66.249.79.5 US, United States 10/Mar/2025:07:03:52 /travel/turkey/goreme/
3.147.59.133 US, United States 10/Mar/2025:07:03:28 /open-source/
36.150.11.84 CN, China 10/Mar/2025:07:03:19 /turkish/nouns.html
52.15.238.187 US, United States 10/Mar/2025:07:03:06 /open-source/file-system.html
20.97.189.100 US, United States 10/Mar/2025:07:03:01 /travel/france/coulee-verte/
23.98.186.178 US, United States 10/Mar/2025:07:01:21 /travel/morocco/fez/meknes-to-fez.html
51.222.253.17 FR, France 10/Mar/2025:07:01:05 /cybersecurity/yubikey/pam_yubico.html
18.118.45.173 US, United States 10/Mar/2025:07:00:47 /open-source/hp-envy-xsane.html
35.222.199.65 US, United States 10/Mar/2025:07:00:45 /ads.txt
100.24.64.232 US, United States 10/Mar/2025:07:00:29 /travel/turkey/trains/
3.147.6.13 US, United States 10/Mar/2025:07:00:21 /open-source/
52.22.66.203 US, United States 10/Mar/2025:07:00:16 /radio/tv-antenna/
3.141.40.74 US, United States 10/Mar/2025:06:59:58 /travel/athens-to-paris/bucharest-gura-humorului.html
66.249.79.5 US, United States 10/Mar/2025:06:59:51 /travel/belgium/bastogne-ardennes/
44.226.39.139 US, United States 10/Mar/2025:06:59:48 /travel/turkey/trains/
65.229.163.234 US, United States 10/Mar/2025:06:59:39 /travel/turkey/trains/
40.77.167.78 US, United States 10/Mar/2025:06:58:57 /travel/uk/orkney-sousterrain/
44.226.39.139 US, United States 10/Mar/2025:06:58:51 /blog/
51.222.253.9 FR, France 10/Mar/2025:06:58:50 /networking/nat.html
81.49.156.87 FR, France 10/Mar/2025:06:58:46 /travel/japan/kofun/empress-koken.html?s=mb
54.166.142.237 US, United States 10/Mar/2025:06:57:56 /cybersecurity/openscap.html;;983121;168;0;5;https:/www.suse.com/c/fr/suse-manager-et-openscap-200-regles-de-securite-pour-vous/;;5963800;165;0;5;https:/www.open-scap.org/security-policies/choosing-policy/;;4915210;162;0;5;https:/yum.oracle.com/oracle-linux-isos.html;;3670115;159;0;5;https:/www.pingcastle.com/;;1835061;152;0;5;;_toc159945929;1835061;146;0;5;;_toc159945928;1835061;140;0;5;;_toc159945927;1835061;134;0;5;;_toc159945926;1835061;128;0;5;;_toc159945925;1835061;122;0;5;;_toc159945924;1835061;116;0;5;;_toc159945923;1835061;110;0;5;;_toc159945922;1835061;104;0;5;;_toc159945921;1835061;98;0;5;;_toc159945920;2031669;92;0;5;;_toc159945919;2031669;86;0;5;;_toc159945918;2031669;80;0;5;;_toc159945917;2031669;74;0;5;;_toc159945916;2031669;68;0;5;;_toc159945915;2031669;62;0;5;;_toc159945914;2031669;56;0;5;;_toc159945913;2031669;50;0;5;;_toc159945912;2031669;44;0;5;;_toc159945911;2031669;38;0;5;;_toc159945910;1966133;32;0;5;;_toc159945909;1966133;26;0;5;;_toc159945908;1966133;20;0;5;;_toc159945907;1966133;14;0;5;;_toc159945906;1966133;8;0;5;;_toc159945905;1966133;2;0;5;;_toc159945904
113.141.91.58 CN, China 10/Mar/2025:06:57:52 /
54.144.11.146 US, United States 10/Mar/2025:06:57:50 /blog/
3.82.113.205 US, United States 10/Mar/2025:06:57:50 /blog/
209.51.181.162 US, United States 10/Mar/2025:06:57:48 /blog/
209.51.181.162 US, United States 10/Mar/2025:06:57:48 /blog/
42.236.17.95 CN, China 10/Mar/2025:06:57:45 /travel/usa/poe-in-new-york/
18.212.150.41 US, United States 10/Mar/2025:06:57:42 /
42.236.17.94 CN, China 10/Mar/2025:06:57:41 /open-source/nginx-openssl-quantum-safe/
209.51.181.162 US, United States 10/Mar/2025:06:57:41 /
157.55.39.56 US, United States 10/Mar/2025:06:57:35 /cybersecurity/generalinfo.html
42.236.17.248 CN, China 10/Mar/2025:06:57:34 /technical/bios.html
42.236.12.241 CN, China 10/Mar/2025:06:57:25 /cybersecurity/crypto/diffie-hellman.html
42.236.17.110 CN, China 10/Mar/2025:06:57:22 /travel/usa/detroit/detroit-part2.html
42.236.17.82 CN, China 10/Mar/2025:06:57:18 /travel/romania/bucharest/
42.236.17.250 CN, China 10/Mar/2025:06:57:18 /travel/usa/detroit/
42.236.17.254 CN, China 10/Mar/2025:06:57:15 /cybersecurity/crypto/diffie-hellman.html
42.236.17.221 CN, China 10/Mar/2025:06:57:11 /open-source/rhel-oracle-centos-6-7-8-9/users-groups.html
3.15.235.45 US, United States 10/Mar/2025:06:57:10 /cybersecurity/intrusion-intro/
3.141.104.77 US, United States 10/Mar/2025:06:57:06 /open-source/uefi.html
42.236.17.228 CN, China 10/Mar/2025:06:57:06 /cybersecurity/privacy-policy.html
31.14.136.210 IT, Italy 10/Mar/2025:06:57:01 /travel/france/
47.128.96.174 CA, Canada 10/Mar/2025:06:56:50 /travel/italy/amalfi/02-the-sights-in-amalfi-and-atrani.html?s=tweetbot
52.167.144.173 US, United States 10/Mar/2025:06:56:46 /travel/usa/new-york-skate-manhattan/
67.202.105.250 US, United States 10/Mar/2025:06:56:43 /ads.txt
51.222.253.10 FR, France 10/Mar/2025:06:56:31 /travel/turkey/hans/?s=mb
18.118.126.70 US, United States 10/Mar/2025:06:56:28 /open-source/mod-26-keypunch.html
18.118.126.70 US, United States 10/Mar/2025:06:56:28 /open-source/rpm-creation.html
54.89.39.159 US, United States 10/Mar/2025:06:56:04 /cybersecurity/openscap.html;;983121;168;0;5;https:/www.suse.com/c/fr/suse-manager-et-openscap-200-regles-de-securite-pour-vous/;;5963800;165;0;5;https:/www.open-scap.org/security-policies/choosing-policy/;;4915210;162;0;5;https:/yum.oracle.com/oracle-linux-isos.html;;3670115;159;0;5;https:/www.pingcastle.com/;;1835061;152;0;5;;_Toc159945929;1835061;146;0;5;;_Toc159945928;1835061;140;0;5;;_Toc159945927;1835061;134;0;5;;_Toc159945926;1835061;128;0;5;;_Toc159945925;1835061;122;0;5;;_Toc159945924;1835061;116;0;5;;_Toc159945923;1835061;110;0;5;;_Toc159945922;1835061;104;0;5;;_Toc159945921;1835061;98;0;5;;_Toc159945920;2031669;92;0;5;;_Toc159945919;2031669;86;0;5;;_Toc159945918;2031669;80;0;5;;_Toc159945917;2031669;74;0;5;;_Toc159945916;2031669;68;0;5;;_Toc159945915;2031669;62;0;5;;_Toc159945914;2031669;56;0;5;;_Toc159945913;2031669;50;0;5;;_Toc159945912;2031669;44;0;5;;_Toc159945911;2031669;38;0;5;;_Toc159945910;1966133;32;0;5;;_Toc159945909;1966133;26;0;5;;_Toc159945908;1966133;20;0;5;;_Toc159945907;1966133;14;0;5;;_Toc159945906;1966133;8;0;5;;_Toc159945905;1966133;2;0;5;;_Toc159945904
3.234.232.0 US, United States 10/Mar/2025:06:55:57 /cybersecurity/openscap.html;;983121;168;0;5;https://www.suse.com/c/fr/suse-manager-et-openscap-200-regles-de-securite-pour-vous/;;5963800;165;0;5;https://www.open-scap.org/security-policies/choosing-policy/;;4915210;162;0;5;https://yum.oracle.com/oracle-linux-isos.html;;3670115;159;0;5;https://www.pingcastle.com/;;1835061;152;0;5;;_toc159945929;1835061;146;0;5;;_toc159945928;1835061;140;0;5;;_toc159945927;1835061;134;0;5;;_toc159945926;1835061;128;0;5;;_toc159945925;1835061;122;0;5;;_toc159945924;1835061;116;0;5;;_toc159945923;1835061;110;0;5;;_toc159945922;1835061;104;0;5;;_toc159945921;1835061;98;0;5;;_toc159945920;2031669;92;0;5;;_toc159945919;2031669;86;0;5;;_toc159945918;2031669;80;0;5;;_toc159945917;2031669;74;0;5;;_toc159945916;2031669;68;0;5;;_toc159945915;2031669;62;0;5;;_toc159945914;2031669;56;0;5;;_toc159945913;2031669;50;0;5;;_toc159945912;2031669;44;0;5;;_toc159945911;2031669;38;0;5;;_toc159945910;1966133;32;0;5;;_toc159945909;1966133;26;0;5;;_toc159945908;1966133;20;0;5;;_toc159945907;1966133;14;0;5;;_toc159945906;1966133;8;0;5;;_toc159945905;1966133;2;0;5;;_toc159945904
93.177.72.125 Unknown 10/Mar/2025:06:55:43 /cybersecurity/openscap.html;;983121;168;0;5;https://www.suse.com/c/fr/suse-manager-et-openscap-200-regles-de-securite-pour-vous/;;5963800;165;0;5;https://www.open-scap.org/security-policies/choosing-policy/;;4915210;162;0;5;https://yum.oracle.com/oracle-linux-isos.html;;3670115;159;0;5;https://www.pingcastle.com/;;1835061;152;0;5;;_Toc159945929;1835061;146;0;5;;_Toc159945928;1835061;140;0;5;;_Toc159945927;1835061;134;0;5;;_Toc159945926;1835061;128;0;5;;_Toc159945925;1835061;122;0;5;;_Toc159945924;1835061;116;0;5;;_Toc159945923;1835061;110;0;5;;_Toc159945922;1835061;104;0;5;;_Toc159945921;1835061;98;0;5;;_Toc159945920;2031669;92;0;5;;_Toc159945919;2031669;86;0;5;;_Toc159945918;2031669;80;0;5;;_Toc159945917;2031669;74;0;5;;_Toc159945916;2031669;68;0;5;;_Toc159945915;2031669;62;0;5;;_Toc159945914;2031669;56;0;5;;_Toc159945913;2031669;50;0;5;;_Toc159945912;2031669;44;0;5;;_Toc159945911;2031669;38;0;5;;_Toc159945910;1966133;32;0;5;;_Toc159945909;1966133;26;0;5;;_Toc159945908;1966133;20;0;5;;_Toc159945907;1966133;14;0;5;;_Toc159945906;1966133;8;0;5;;_Toc159945905;1966133;2;0;5;;_Toc159945904
3.134.253.225 US, United States 10/Mar/2025:06:55:21 /open-source/kmail-to-thunderbird.html
35.175.92.196 US, United States 10/Mar/2025:06:55:18 /cybersecurity/openscap.html;;983121;168;0;5;https:/www.suse.com/c/fr/suse-manager-et-openscap-200-regles-de-securite-pour-vous/;;5963800;165;0;5;https:/www.open-scap.org/security-policies/choosing-policy/;;4915210;162;0;5;https:/yum.oracle.com/oracle-linux-isos.html;;3670115;159;0;5;https:/www.pingcastle.com/;;1835061;152;0;5;;_Toc159945929;1835061;146;0;5;;_Toc159945928;1835061;140;0;5;;_Toc159945927;1835061;134;0;5;;_Toc159945926;1835061;128;0;5;;_Toc159945925;1835061;122;0;5;;_Toc159945924;1835061;116;0;5;;_Toc159945923;1835061;110;0;5;;_Toc159945922;1835061;104;0;5;;_Toc159945921;1835061;98;0;5;;_Toc159945920;2031669;92;0;5;;_Toc159945919;2031669;86;0;5;;_Toc159945918;2031669;80;0;5;;_Toc159945917;2031669;74;0;5;;_Toc159945916;2031669;68;0;5;;_Toc159945915;2031669;62;0;5;;_Toc159945914;2031669;56;0;5;;_Toc159945913;2031669;50;0;5;;_Toc159945912;2031669;44;0;5;;_Toc159945911;2031669;38;0;5;;_Toc159945910;1966133;32;0;5;;_Toc159945909;1966133;26;0;5;;_Toc159945908;1966133;20;0;5;;_Toc159945907;1966133;14;0;5;;_Toc159945906;1966133;8;0;5;;_Toc159945905;1966133;2;0;5;;_Toc159945904
3.82.69.40 US, United States 10/Mar/2025:06:55:18 /cybersecurity/openscap.html;;983121;168;0;5;https://www.suse.com/c/fr/suse-manager-et-openscap-200-regles-de-securite-pour-vous/;;5963800;165;0;5;https://www.open-scap.org/security-policies/choosing-policy/;;4915210;162;0;5;https://yum.oracle.com/oracle-linux-isos.html;;3670115;159;0;5;https://www.pingcastle.com/;;1835061;152;0;5;;_Toc159945929;1835061;146;0;5;;_Toc159945928;1835061;140;0;5;;_Toc159945927;1835061;134;0;5;;_Toc159945926;1835061;128;0;5;;_Toc159945925;1835061;122;0;5;;_Toc159945924;1835061;116;0;5;;_Toc159945923;1835061;110;0;5;;_Toc159945922;1835061;104;0;5;;_Toc159945921;1835061;98;0;5;;_Toc159945920;2031669;92;0;5;;_Toc159945919;2031669;86;0;5;;_Toc159945918;2031669;80;0;5;;_Toc159945917;2031669;74;0;5;;_Toc159945916;2031669;68;0;5;;_Toc159945915;2031669;62;0;5;;_Toc159945914;2031669;56;0;5;;_Toc159945913;2031669;50;0;5;;_Toc159945912;2031669;44;0;5;;_Toc159945911;2031669;38;0;5;;_Toc159945910;1966133;32;0;5;;_Toc159945909;1966133;26;0;5;;_Toc159945908;1966133;20;0;5;;_Toc159945907;1966133;14;0;5;;_Toc159945906;1966133;8;0;5;;_Toc159945905;1966133;2;0;5;;_Toc159945904
44.195.172.135 US, United States 10/Mar/2025:06:55:17 /cybersecurity/openscap.html;;983121;168;0;5;https://www.suse.com/c/fr/suse-manager-et-openscap-200-regles-de-securite-pour-vous/;;5963800;165;0;5;https://www.open-scap.org/security-policies/choosing-policy/;;4915210;162;0;5;https://yum.oracle.com/oracle-linux-isos.html;;3670115;159;0;5;https://www.pingcastle.com/;;1835061;152;0;5;;_Toc159945929;1835061;146;0;5;;_Toc159945928;1835061;140;0;5;;_Toc159945927;1835061;134;0;5;;_Toc159945926;1835061;128;0;5;;_Toc159945925;1835061;122;0;5;;_Toc159945924;1835061;116;0;5;;_Toc159945923;1835061;110;0;5;;_Toc159945922;1835061;104;0;5;;_Toc159945921;1835061;98;0;5;;_Toc159945920;2031669;92;0;5;;_Toc159945919;2031669;86;0;5;;_Toc159945918;2031669;80;0;5;;_Toc159945917;2031669;74;0;5;;_Toc159945916;2031669;68;0;5;;_Toc159945915;2031669;62;0;5;;_Toc159945914;2031669;56;0;5;;_Toc159945913;2031669;50;0;5;;_Toc159945912;2031669;44;0;5;;_Toc159945911;2031669;38;0;5;;_Toc159945910;1966133;32;0;5;;_Toc159945909;1966133;26;0;5;;_Toc159945908;1966133;20;0;5;;_Toc159945907;1966133;14;0;5;;_Toc159945906;1966133;8;0;5;;_Toc159945905;1966133;2;0;5;;_Toc159945904
3.15.142.28 US, United States 10/Mar/2025:06:55:15 /open-source/sysfs.html
185.7.214.130 FR, France 10/Mar/2025:06:55:09 /contact.html
185.7.214.130 FR, France 10/Mar/2025:06:55:08 /
18.188.130.151 US, United States 10/Mar/2025:06:54:39 /cybersecurity/intrusion-analysis/
51.222.253.3 FR, France 10/Mar/2025:06:54:12 /travel/japan/kofun/emperor-suinin.html
66.249.79.5 US, United States 10/Mar/2025:06:53:47 /travel/morocco/tangier/arrival.html

Here's what's going on.

Each line above is a request from a client, extracted from Nginx's /var/www/logs/httpd-access.log file. The client IP address, timestamp, and requested path were selected with awk and the client IP address converted to a country if possible with geoiplookup.

Geolocate IP

You can use a service such as Abstract's IP geolocation to check if the conversion was successful, or if the client IP address is the exit portal of a VPN.

The first 3 octets or first 24 bits of the IP address are used to specify the hue, with chroma at 75% and intensity at 100%. The resulting red, green, and blue values are scaled to the range of 0-255 and printed as two-character hexadecimal in an HTML style string.

Low-numbered /8 networks appear as red, 20.0.0.0/8 through 40.0.0.0/8 are orange shifting to yellow, 50.0.0.0/8 through 110.0.0.0/8 are shades of green, the /16 networks 130.0.0.0/16 through about 180.0.0.0/16 are shades of blue, then it's shades of purple into magenta for the /24 networks 192.0.0.0/24 and up through 223.255.255.0/24.

The HTML file on the server has a line where PHP uses passthru() to call the following shell script:

#!/bin/sh

# Initial pipeline:
# tail		Just the last 200 (or slightly less after the grep)
# grep		... just the requests out of that
# cat | sort	... put into reverse order
# sed		... remove the quotes and square brackets
# awk		... print the IP address twice, timestamp, and requested path
# sed		... remove the first 3 dots to split first version of IP
#			address into octets, and remove any characters that
#			could cause trouble when inserted into this page
# I need to use the client IP address, field #5 at that point, to call
# geoiplookup.  So, send the initial pipeline into a while loop that
# assigns variables, sets a new variable, and then echoes the resulting
# collection into awk.
tail -200 /var/www/logs/access_log |
	grep 'GET.*200' |
	cat -n | sort -nr |
	sed -e 's/"/ /g' -e 's/\[//g' -e 's/\]//g' |
	awk '{print $2, $2, $5, $8}' |
	sed -e 's/\./ /' -e 's/\./ /' -e 's/\./ /' -e 's/[<>]//g' |
	while read IP1 IP2 IP3 IP4 CLIENTIP TIMESTAMP URL
	do
		COUNTRY=$( geoiplookup $CLIENTIP |
				sed 's/.*Edition: //' |
				sed 's/IP Address not found/Unknown/' )
		echo $IP1 $IP2 $IP3 $IP4 $CLIENTIP $COUNTRY $TIMESTAMP $URL |
		awk '{
			ip1 = $1;
			ip2 = $2;
			ip3 = $3;
			chroma = 0.75;
			hue = 6*(ip1*255*255 + ip2*255 + ip3)/(255*255*255);
			if (hue%2 > 1) {
				x = chroma*(1.0 - (hue%2 - 1));
			} else {
				x = chroma*(1.0 - (1 - hue%2));
			}
			if (hue < 1.0) {
				r = chroma;
				g = x;
				b = 0;
			} else if (hue < 2.0) {
				r = x;
				g = chroma;
				b = 0;
			} else if (hue < 3.0) {
				r = 0;
				g = chroma;
				b = x;
			} else if (hue < 4.0) {
				r = 0;
				g = x;
				b = chroma;
			} else if (hue < 5.0) {
				r = x;
				g = 0;
				b = chroma;
			} else {
				r = chroma;
				g = 0;
				b = x;
			}
			r = (r + 0.25)*255;
			g = (g + 0.25)*255;
			b = (b + 0.25)*255;

			printf("<div class=\"col-12 textleft\" ");
			printf("style=\"color:#000; background:#%02x%02x%02x;\"> ", r, g, b);
			for (i = 5; i <= NF; i++) {
				printf("%s ", $i);
			}
			printf("</div>\n");
		}'
	done 

Other Pages