Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-07-02 20:30:27

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Visitor logs, Host field

Liking Textpattern 4.5.7, the backend enhancements especially.

I’ve brought this up before, there’s a forum thread somewhere where Mary shot down my idea.

Anyway, this is the situation, the default Visitor logs display shows Host, since I have Use DNS lookup in visitor logs? turned off, all I get is an IP address. Now let’s say you want to lookup that IP address’ location, you can’t copy the Host column IP address since it has special characters. So you have to click Show more detail to display the IP, so you can copy/paste it into some “where is this IP located” site.

What I propose, ask, plead, is to switch out the IP and Host columns, the default display would show IP, click more details would show you the Host. For those who like the Host field to display, and have turned on Use DNS lookup in visitor logs?, then show them Host on the default Visitor logs display.

Does this make sense?

Offline

#2 2015-07-02 23:58:06

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,079
Website

Re: Visitor logs, Host field

There are quite a few changes around this in 4.6dev (including whois lookup-linking, I think), not sure if they would go towards your nirvana (I have logging disabled on my local 4.6dev install)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#3 2015-07-03 00:09:43

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Visitor logs, Host field

This is what I have installed on my local server: Textpattern version: 4.6-dev (3f057f6706500276344eb3cbff58b754)

The Visitor Logs tab is not even an option in the drop down menu, hadn’t even noticed that.

Offline

#4 2015-07-03 00:26:21

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,079
Website

Re: Visitor logs, Host field

Yeah, logging is disabled by default on new installs. You should be able to turn it back on in the prefs, though.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#5 2015-07-03 02:12:58

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Visitor logs, Host field

phiw13 wrote #292531:

Yeah, logging is disabled by default on new installs. You should be able to turn it back on in the prefs, though.

You are right, the Logs are removed from the drop down menu if logging is turned off.

But you could turn off logging for a bit, and still have log entries that you’d want to visit on the backend.

Offline

#6 2015-07-03 06:51:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Visitor logs, Host field

hcgtv wrote #292534:

But you could turn off logging for a bit, and still have log entries that you’d want to visit on the backend.

That’s true. Hadn’t thought of that. Perhaps removing the menu item is a step too far. We can reinstate the menu regardless of the setting, no problem.

I believe that same notion has been done with Comments if you turn those off from Prefs too. Would have to check.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2015-07-03 07:31:28

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Visitor logs, Host field

Don’t mess with my nirvana. When I turn comments off, I don’t want to see that shit in the UI again. Never. Nowhere. Whether I had any comments or not. On or off. No middle nonsense. ;)

Regarding logs, some hosts put a cap on what Textpattern is allowed to log. I’m not sure how it works, but Kaizen Garden, for example, does this for reasons of server abuse, or conservation, or something.

I’ve never really given logs much thought. They never seemed very useful for anything outside of a little vanity checking. I like knowing they’re there, though.

Offline

#8 2015-07-05 13:48:20

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Visitor logs, Host field

This particular change to the logs is something I carry with me from rev to rev, as I imagine many longtime Textpattern users probably have their own customized TXP install that they use.

So asking for this change allows me to have one less mod to carry over, but in the grand scheme of things, with limited resources on the Textpattern dev side, maybe carrying around mods is the way to go, rather than ask for little chnages here and there, and let you all concentrate on the big things.

These are my mods to the txp_log.php:

  • Moved log_detail to the IP field, away from the HOST field.
  • Instead of using the gTime function, I just call the date function, mostly for formatting, smaller date field.
  • I also add 3 hours to the log time – localtime is Los Angeles, this is how DreamHost has their servers configured.
--- D:\Hcgtv\source\textpattern\textpattern-4.5.7\textpattern\include\txp_log.php	2012-08-20 11:32:19.000000000 -0400
+++ D:\Download\code\txp_log.php	2015-07-04 16:38:01.000000000 -0400
@@ -170,14 +170,14 @@
 				n.'<div class="txp-listtables">'.
 				n.startTable('', '', 'txp-list').
 				n.'<thead>'.
 				n.tr(
 					n.hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' title="'.gTxt('toggle_all_selected').'" class="multi-edit"').
 					n.column_head('time', 'time', 'log', true, $switch_dir, $crit, $search_method, (('time' == $sort) ? "$dir " : '').'date time').
-					n.column_head('IP', 'ip', 'log', true, $switch_dir, $crit, $search_method, (('ip' == $sort) ? "$dir " : '').'log_detail ip').
-					n.column_head('host', 'host', 'log', true, $switch_dir, $crit, $search_method, (('host' == $sort) ? "$dir " : '').'host').
+					n.column_head('IP', 'ip', 'log', true, $switch_dir, $crit, $search_method, (('ip' == $sort) ? "$dir " : '').'ip').
+					n.column_head('host', 'host', 'log', true, $switch_dir, $crit, $search_method, (('host' == $sort) ? "$dir " : '').'log_detail host').
 					n.column_head('page', 'page', 'log', true, $switch_dir, $crit, $search_method, (('page' == $sort) ? "$dir " : '').'page').
 					n.column_head('referrer', 'refer', 'log', true, $switch_dir, $crit, $search_method, (('refer' == $sort) ? "$dir " : '').'refer').
 					n.column_head('method', 'method', 'log', true, $switch_dir, $crit, $search_method, (('method' == $sort) ? "$dir " : '').'log_detail method').
 					n.column_head('status', 'status', 'log', true, $switch_dir, $crit, $search_method, (('status' == $sort) ? "$dir " : '').'log_detail status')
 			).
 			n.'</thead>';
@@ -211,18 +211,18 @@
 				echo tr(
 					n.td(
 						fInput('checkbox', 'selected[]', $log_id)
 					, '', 'multi-edit').
 					td(
-						gTime($log_uTime)
+						date("Y-m-d H:i:s", strtotime('+3 hours', $log_uTime))
 					, '', 'date time').
-					td(txpspecialchars($log_ip), '', 'log_detail ip').
+					td(txpspecialchars($log_ip), '', 'ip').
-					td(txpspecialchars(soft_wrap($log_host, 30)), '', 'host').
+					td(txpspecialchars(soft_wrap($log_host, 30)), '', 'log_detail host').
 					td($log_page, '', 'page').
 					td($log_refer, '', 'refer').
 					td(txpspecialchars($log_method), '', 'log_detail method').
 					td($log_status, '', 'log_detail status')
 				);

Now I can copy/paste the IP into a lookup my ip site to see who the hell is trying to break in to my site using a WordPress sign in, idiots!

Moving forward, it would be nice to be able to toggle columns from detail display and back, not just on the logs but on every listing on the backend.

As for adding 3 hours to the logs, and I imagine I’m not the only one this affects, that could easily be a setting under enable logs.

Back to the grind, ooh I got a new laptop for coding in bed ;)

Offline

#9 2015-07-05 14:17:58

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Visitor logs, Host field

hcgtv wrote #292586:

Moved log_detail to the IP field, away from the HOST field.

That seems like a reasonable change to make in core. The choices over what is ‘detail’ and what isn’t are sometimes rather arbitrary, it seems. But your reasoning for making the change:

you can’t copy the Host column IP address since it has special characters

What special characters? I can copy and paste stuff from the Host column just fine (OSX). At least for IPv4 addresses: haven’t got any IPv6s to try it out on. Are your dots encoded or something on your system, which renders the pasted output in an entity-encoded format? If so, we should figure out why and try to find a solution.

Instead of using the gTime function, I just call the date function, mostly for formatting, smaller date field.

Again, not unreasonable. If exporting the table (ahem, copy / paste), using Y-M-D H:i:s means it’d be easier to sort by date in your external application, although you could do that in Txp prior to grabbing the table I suppose. This whole logs thing is just a bit… incomplete in Txp.

I also add 3 hours to the log time

Isn’t this the role of setting the Timezone in prefs? I though that was for setting the timezone of your server so that everything is stored relative to that? Maybe I’m wrong.

Yeah, it’s a bit crappy. Dates should be stored internally as UTC, or date + timezone so we can more easily apply offsets and know when articles are actually posted (and when DST steps in to foul things up). Must admit I’m a little ignorant of all this stuff, being in the envious position of being at GMT, the centre of the timezone universe.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2015-07-05 14:34:24

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Visitor logs, Host field

Bloke wrote #292588:

What special characters? I can copy and paste stuff from the Host column just fine (OSX).

Here’s a copy paste from one of my sites (222.111.247.58 is the IP) viewing as hex in Notepad++.

Host field: 32 32 32 2e 3f 31 31 31 2e 3f 32 34 37 2e 3f 35 38
IP field: 32 32 32 2e 31 31 31 2e 32 34 37 2e 35 38

There appears to be some 3f’s thrown in the Host field.

Isn’t this the role of setting the Timezone in prefs? I though that was for setting the timezone of your server so that everything is stored relative to that? Maybe I’m wrong.

Timezone works for writing articles, it doesn’t affect the logs display.

Offline

#11 2015-07-05 14:37:57

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Visitor logs, Host field

hcgtv wrote #292590:

Host field: 32 32 32 2e 3f 31 31 31 2e 3f 32 34 37 2e 3f 35 38

3F is question mark in ASCII. What the…? I’ll see if I can get to the bottom of that.

Timezone works for writing articles, it doesn’t affect the logs display.

Well that’s just backwards. Surely the timezone setting should be applied throughout the entire Txp ecosystem?! Mad.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2015-07-05 17:49:26

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: Visitor logs, Host field

Destry wrote #292548:

I’ve never really given logs much thought. They never seemed very useful for anything outside of a little vanity checking. I like knowing they’re there, though.

+1 to this. It’s why services like Piwik, Googlytics, HitTail et al are so popular.

Offline

Board footer

Powered by FluxBB