Can not delete logs from system utilities

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
jpimentel
Posts: 39
Joined: Wed Jan 18, 2006 11:09 am

Can not delete logs from system utilities

Post by jpimentel »

I have been working on cacti trying to fix some other problems I had today, and noticed that when I click clear cacti log file the alarms remain there, and only refresh. The link for the action is = to http://address/cacti/utilities.php?action=clear_logfile.

Any suggestions?
JP
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

The webserver's user seems to lack write permissions for that file
Reinhard
jpimentel
Posts: 39
Joined: Wed Jan 18, 2006 11:09 am

Post by jpimentel »

How do I check which user was created for mysql? The server I am on has a bunch of users, not sure which account to give the permissions to.

chown -R cactiuser rra/ log/

When it was installed I guess cactiuser was not selected.
JP
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

jpimentel wrote:How do I check which user was created for mysql? The server I am on has a bunch of users, not sure which account to give the permissions to.

chown -R cactiuser rra/ log/

When it was installed I guess cactiuser was not selected.
I did not ask for the mysql user, I asked for the webserver's (httpd) user. The chown above is correct. But the logfile may need special permissions. Personally, I do not like that: deleting files from a browser. So I did not walk through this.
Reinhard
jpimentel
Posts: 39
Joined: Wed Jan 18, 2006 11:09 am

Post by jpimentel »

It just bugs me that it does not do what it is supposed to do, and that I dont know why, lol. Cactiuser has the proper permissions, but unfortunitly I can still not delete. When you say special permissons, what do you mean. I gave 777 so it should have total access. Is there somthing else I should look into?
JP
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Write access for the directory? Not that sure on file permissions, sorry
Reinhard
jpimentel
Posts: 39
Joined: Wed Jan 18, 2006 11:09 am

Post by jpimentel »

Thanks for the help. I am in the right direction now. I will let ya know what was wrong and how I fixed it.

Thanks again

Cheers!
JP
User avatar
N3NCY
Cacti User
Posts: 260
Joined: Thu Sep 22, 2005 7:50 pm
Location: Landenberg, PA
Contact:

Post by N3NCY »

For me, the fix was:
chown -R nobody /opt/apache/htdocs/cacti/

My web server runs as user "nobody"
My cacti is installed in /opt/apache/htdocs/cacti/
Thank you,

Ernie
http://www.NMSWorld.com
[b]Dual Zeon Dual Core 2.6Ghz / 8GB RAM / 4x15k RPM SATA RAID5[/b]
[b]Cacti Version[/b] - 0.8.7b
[b]Poller Type[/b] - cactid 0.8.7 with Boost v1.7
[b]Server Info[/b] - FreeBSD 7.0-RELEASE
[b]Web Server[/b] - Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8g DAV/2 PHP/5.2.5 mod_perl/2.0.3 Perl/v5.8.8
[b]PHP[/b] - 5.2.6
[b]MySQL[/b] - 5.0.51b Mod: poller_output ENGINE = MEMORY
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.4.1
[b]Plugins[/b] - Host Info (hostinfo - v0.2), Update Checker (update - v0.3), Network Tools (tools - v0.2), FlowView (flowview - v0.3), Read-only Devices Tab (devices - v0.4), Network Discovery (discovery - v0.8.3), Syslog Monitoring (syslog - v0.5.2), Thresholds (thold - v0.3.9), Device Monitoring (monitor - v0.8.2), PHP Network Weathermap (weathermap - v0.941), SuperLinks (superlinks - v0.72), Report Creator (reports - v0.1b)
jpimentel
Posts: 39
Joined: Wed Jan 18, 2006 11:09 am

Post by jpimentel »

\var\www\html\cacti is where mine is. The user is cacti user. I have set the correct permissions but for some unknown reason to me, I can only clear the logs manually through command line.

drwxr-xr-x 2 cactiuser cacti 4096 Feb 20 11:53 log
I am still looking into it, and as soon as I find a solution I will post. If you have any suggestions, let me know. ;)
JP
jpimentel
Posts: 39
Joined: Wed Jan 18, 2006 11:09 am

Post by jpimentel »

Anyone have any suggestions. I am still having problems with this one.
JP
elnino
Cacti User
Posts: 205
Joined: Tue Mar 08, 2005 9:51 pm

Post by elnino »

jpimentel wrote:\var\www\html\cacti is where mine is. The user is cacti user. I have set the correct permissions but for some unknown reason to me, I can only clear the logs manually through command line.

Does Apache run as cactiuser also? On most systems, Apache runs as "nobody" and that is the user that needs access to delete the log file. If you are unsure, run this command:

Code: Select all

ps -ef | grep httpd
jpimentel
Posts: 39
Joined: Wed Jan 18, 2006 11:09 am

Post by jpimentel »

[root@syslog /]# ps -ef | grep httpd
root 30764 1 0 Feb17 ? 00:00:00 /usr/sbin/httpd
apache 16192 30764 0 Feb19 ? 00:00:43 /usr/sbin/httpd
apache 16193 30764 0 Feb19 ? 00:00:43 /usr/sbin/httpd
apache 16194 30764 0 Feb19 ? 00:00:44 /usr/sbin/httpd
apache 16196 30764 0 Feb19 ? 00:00:44 /usr/sbin/httpd
apache 16197 30764 0 Feb19 ? 00:00:39 /usr/sbin/httpd
apache 16198 30764 0 Feb19 ? 00:00:41 /usr/sbin/httpd
apache 16201 30764 0 Feb19 ? 00:00:44 /usr/sbin/httpd
apache 11972 30764 0 Feb20 ? 00:00:32 /usr/sbin/httpd
root 20046 19994 0 13:11 pts/3 00:00:00 grep httpd


This is what I got.
JP
elnino
Cacti User
Posts: 205
Joined: Tue Mar 08, 2005 9:51 pm

Post by elnino »

jpimentel wrote:[root@syslog /]# ps -ef | grep httpd
root 30764 1 0 Feb17 ? 00:00:00 /usr/sbin/httpd
apache 16192 30764 0 Feb19 ? 00:00:43 /usr/sbin/httpd
apache 16193 30764 0 Feb19 ? 00:00:43 /usr/sbin/httpd
apache 16194 30764 0 Feb19 ? 00:00:44 /usr/sbin/httpd
apache 16196 30764 0 Feb19 ? 00:00:44 /usr/sbin/httpd
apache 16197 30764 0 Feb19 ? 00:00:39 /usr/sbin/httpd
apache 16198 30764 0 Feb19 ? 00:00:41 /usr/sbin/httpd
apache 16201 30764 0 Feb19 ? 00:00:44 /usr/sbin/httpd
apache 11972 30764 0 Feb20 ? 00:00:32 /usr/sbin/httpd
root 20046 19994 0 13:11 pts/3 00:00:00 grep httpd


This is what I got.
Ok, try making apache owner of your Cacti log file and see if the "Clear log file" link works. You might need to do it on the directory also, I'm not sure
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Ok, this thread is annoying me... Mostly because no one has given an answer that is a good answer.

The proper permissions should only be applyed as such:
  • <cacti_path> should be owned by the cactiuser or some user OTHER THAN THE WEB SERVER. This is important as you don't want the webserver to have to abbility to overwrite php scripts.
  • <cacti_path>/rra should be world readable but only writeable by the user that runs the poller, IE, cactiuser.
  • <cacti_path>/log should be world readable and writable by the user that runs the poller. If you want to have the ability to clear the log from the web interface, then special permissions should be used. The best approach is to apply a sticky bit to the group permissions so that all files in the directory are set to the same group, despite the owner. So, you would make sure that you poller user and the webserver are members of the same group, IE, cactilog, and apply the following permissions to the <cacti_path>/logs directory: `chmod 2775 <cacti_path>/logs; chgrp cactilog <cacti_path>/logs`. This way any file in the <cacti_path>/logs directory if created by the poller or by the webserver will still be readable and writeable by the poller and the web server.
Any questions, let me know.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
jpimentel
Posts: 39
Joined: Wed Jan 18, 2006 11:09 am

Post by jpimentel »

Thank you Tony
JP
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests