This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » Developer » updateviewcount problems
expandshrink

updateviewcount problems

updateviewcount problems

Thursday 27 September 2012 10:06:10 pm - 5 replies

Hi!

It's about the "view_top_list" fetch.

When I run the updateviewcount script through cronjob I get the following:

Running cronjobs/updateviewcount.php at: 27/09/2012 19:57
Update content view count...
Started at Giovedì, 27 Settembre 2012 19:57:02
 
Start line:
 
Warning: apache log-file '/var/log/httpd/access_log' doesn't exist, please check your ini-settings and try again.
Finished at Giovedì, 27 Settembre 2012 19:57:02
 
View count have been updated!
 
Completing cronjobs/updateviewcount.php at: 27/09/2012 19:57
Elapsed time: 00:00:00

...

I set the /settings/override/logfile.ini.append.php with the log-file name and the path to the Apache log directory

StorageDir=/var/log/httpd
LogFileName=access_log

The log file access_log is located at /var/log/httpd of the Apache Server but simply contains lines like this

127.0.0.1 - - [27/Sep/2012:20:41:52 +0200] "GET / HTTP/1.0" 403 5043 "-" "Apache/2.2.3 (CentOS) (internal dummy connection)"

...

Any idea how to fix this in order to have the updateviewcount run the way it is supposed to?

Thanks!

Modified on Thursday 27 September 2012 10:07:42 pm by Lo' F.

Friday 28 September 2012 9:06:33 am

This is gonna be specific to your total hosting environment.  Once you find the real location of the log files, you should be in good shape.

So, its really about looking at the settings of the http config and seeing where the live files are.  This gets more confusing (or maybe convenient) in that some hosted environments where after midnight, the live logs are rotated into the user's directory somewhere. So if you run it in the early morning, yesterday's logs may have been rotated under something like /home/user/logs or similiar

Some varients for hosted systems follow to give you a starting point to look (even though the httpd config holds the answer):

Somewhat standard:

  • /var/log/apache/domainname-access.log (or similiar)
  • /var/log/apache/domains/domainname-access.log (or similiar)

Direct admin mucking about:

  • /some/goofy/directory/hostname-something.log
    (followed by a rotation into a local dir)

Setup thorough webmin/usermin

  • /home/username/domain/logs/logfoleofsomename.log

 

Modified on Friday 28 September 2012 9:08:06 am by David Ennis

Sunday 30 September 2012 10:19:05 pm

Hi David, thanks for your reply.

I checked the httpd.conf file located at /etc/httpd/conf and the original setting is

CustomLog logs/access_log combined

There is also an access_log file inside the directory /etc/httpd/logs with the same occurences of this line

127.0.0.1 - - [27/Sep/2012:20:41:52 +0200] "GET / HTTP/1.0" 403 5043 "-" "Apache/2.2.3 (CentOS) (internal dummy connection)"

I tried to rise the limit of MinSpareServers and MaxSpareServers from 1 to 20 and from 5 to 50 in the httpd.conf, following the directive I found in another forum said as a possible solution but ... nothing happened.

...

Modified on Sunday 30 September 2012 10:22:41 pm by Lo' F.

Sunday 30 September 2012 11:20:40 pm

Quote from Lo' F. :

Hi David, thanks for your reply.

I checked the httpd.conf file located at /etc/httpd/conf and the original setting is

CustomLog logs/access_log combined

There is also an access_log file inside the directory /etc/httpd/logs with the same occurences of this line

127.0.0.1 - - [27/Sep/2012:20:41:52 +0200] "GET / HTTP/1.0" 403 5043 "-" "Apache/2.2.3 (CentOS) (internal dummy connection)"

I tried to rise the limit of MinSpareServers and MaxSpareServers from 1 to 20 and from 5 to 50 in the httpd.conf, following the directive I found in another forum said as a possible solution but ... nothing happened.

...

HI.

That's the main default log.  Usually logs per domain are separated out.  

If this is set up by virtualhost in any way (port ot hostname), then there will be a separate conf file per domain.  On Debial installs, its in the sites-available directry and even the default domain is configured separately from the main httpd.conf.

 

If all you see are  the worker log messages (dummy connection) then somewhere you should still have a log file for your domain separate from that one....

Are you using any type of hosting management software like DirctAdmin, Webmin, Plesk, etc Knowing that will help point you in the right direction.  I would also do a search for CustomLog in /etc

find /etc/apache2 |sed "s/.*/grep 'CustomLog' &/"|sh

or for centos

find /etc/httpd |sed "s/.*/grep 'CustomLog' &/"|sh

BTW: the dummy log messages are harmless  However, you could consider removing them to reduce disk writes.. 

.

Monday 01 October 2012 10:28:28 pm

Thank you, David. Very useful!

I believe the right access_log file is located in /var/www/vhosts/domainname.it/statistics/logs

so I changed the configuration of the logfile.ini.append.php to

[AccessLogFileSettings]
StorageDir=/var/www/vhosts/domainname.it/statistics/logs
LogFileName=access_log

but again when I run the script in return I get the same warning message

Running cronjobs/updateviewcount.php at: 01/10/2012 22:06
Update content view count...
Started at Lunedì, 01 Ottobre 2012 22:06:01
 
Start line:
 
Warning: apache log-file '/var/www/vhosts/domainname.it/statistics/logs/access_log' doesn't exist, please check your ini-settings and try again.
Finished at Lunedì, 01 Ottobre 2012 22:06:01
 
View count have been updated!
 
Completing cronjobs/updateviewcount.php at: 01/10/2012 22:06
Elapsed time: 00:00:00

:/

The http requests tracked in the access_log file are of this king

xx.xxx.xxx.xx - - [01/Oct/2012:22:22:44 +0200] "GET  /index.php/Primo-Piano/Consulta-salva-legge-194-inammissibile-la-questione-di-legittimita-dell-articolo-4  HTTP/1.1" 200 99486  "http://www.domainname.it/index.php/Attualita/Talidomide-dopo-50-anni-le-scuse-dell-azienda-tedesca-alle-vittime-del-farmaco"  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:15.0) Gecko/20100101  Firefox/15.0.1"

...

Monday 01 October 2012 11:21:39 pm

Cool.. You are on the right track... Just one more hurdle....

.....permissions most likely happy.gif Emoticon

By default, log files will only be readable by certain user/group

Example, perhaps owned by httpd.httpd with a mask of 750 or www-data.www-data with 750

On Debian systems, the setting is by default, I believe root.adm 750 (people in the admin group can read)  This is not a problem on DirectAdmin and Plesk because they nightly rotate the logs to the owner of the website, but a non messed-with system will not have them available by any standard user..

So, by default, unless you ran the cronjob as root, permission denied could give the false error of file not found (specifically because there was permission denied to read the content of a parent directory, so the message is a bit misleading, but true. "I could not find the file because I could not list the directory)

Easy-peasy-happy-litttle-test:

cp /var/www/vhosts/domainname.it/statistics/logs/access_log /tmp/testlog
chmod 777 /tmp/testlog
change config:


<span>[AccessLogFileSettings]</span><span>StorageDir</span><span>=</span><span>/tmp</span><span>LogFileName</span><span>=</span><span>testlog</span>

 

 

If it then works, then permissions were your problem..

In any case, remove the test file from tmp after the test as log files should be protected

If a permissions issue, either:

  • run as root if you are comfortable with that for the cronjob
  • OR root cronjob that copies the file nightly to a holding area and changes permissions accordingly
    then separately as your proper user and later on (5 mins later), process the log and remove ti when done (you will still have the original safely tucked away still) 

-David

 

P.S. Nice website, btw happy.gif Emoticon

Modified on Monday 01 October 2012 11:23:54 pm by David Ennis

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from