Sponsored Content
Full Discussion: logrotate httpd logfiles
Operating Systems Linux Red Hat logrotate httpd logfiles Post 302386018 by renuka on Monday 11th of January 2010 05:01:37 AM
Old 01-11-2010
logrotate httpd logfiles

Hi,
I need to logrotate logs in directories in /var/log/httpd/. There are 4 directories in /var/log/httpd/... these directories are /var/log/httpd/access/
/var/log/httpd/debug/
/var/log/httpd/error/
/var/log/httpd/required/
Each of the access, required, error and debug directories have around 20 to 30 access log files of different locations for example:mumbai-access.log, pune-access.log etc..same is the case for 'error' dir 'required' dir and 'debug' dir in /var/log/httpd/
I need to clean up the logfiles in all the 4 directories access, error, debug and required...
I have made a custom logrotate file as follows:
-------------------------------------------------------------------------
Code:
# vi /etc/logrotate.d/httpd-logs
/var/log/httpd/access/*.monitor.com-access_log 
{
weekly
missingok
nocreate
postrotate
find /var/log/httpd/access -name '*.monitor.com-access_log' -type f -mtime +7 -print | xargs /bin/rm -rf
endscript 
}
/var/log/httpd/error/*.monitor.com-error_log
{
weekly
missingok
nocreate
postrotate
find /var/log/httpd/error -name '*.monitor.com-error_log' -type f -mtime +7 -print | xargs /bin/rm -rf
endscript 
}
/var/log/httpd/request/*.monitor.com-ssl_request_log
{
weekly
missingok
nocreate
postrotate
find /var/log/httpd/request -name '*.monitor.com-ssl_request_log' -type f -mtime +7 -print | xargs /bin/rm -rf
endscript 
}
/var/log/httpd/debug/*.monitor.com-rw_log
{
weekly
notifempty
missingok
compress
}

---------------------------------------------------------------------------
Is the above config correct?
Am I missing something? Will this logrotate the files in /var/log/httpd/access, /var/log/httpd/error, /var/log/httpd/required and /var/log/httpd/error ?
do i need to include following line in postrotate " /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true" ?

Last edited by pludi; 01-11-2010 at 06:13 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Logfiles

My server has only has access logs turned on. How do I turn on the other standard logs (i.e. I'd like to see the referring urls). Thanks in advance. (3 Replies)
Discussion started by: pingdom
3 Replies

2. UNIX for Dummies Questions & Answers

Controlling logfiles

I support an app that outputs alert and audit messages to one log file (vendor says they can't be separated). The script that I have written takes a copy (mv cmd) of the file to do the separation and reformatting. I have a problem that I loose records (messages are being written constantly, upto 3+... (5 Replies)
Discussion started by: nhatch
5 Replies

3. Shell Programming and Scripting

Logfiles E-mailed

Hi All There are some cron jobs ,which runs 24 hrs. Log files are generated when one job fails. So I need the log files to be emailed to my personal e-mail id. So that I can see the log files at my home If there is any error. How can I implement this in Unix shell programming. Thanks... (4 Replies)
Discussion started by: deep_kol
4 Replies

4. Shell Programming and Scripting

split monthly logfiles into daily logfiles

Hi, I have a lot of logfiles like fooYYYYMM.log (foo200301.log, foo200810.log) with lines like YYYY-MM-DD TIMESTAMP,text1,text2,text3... but I need (for postprocessing) the form fooYYYYMMDD.log (so foo200402.log becomes foo20040201.log, foo20040202.log...) with unmodified content of lines. ... (1 Reply)
Discussion started by: clzupp
1 Replies

5. Shell Programming and Scripting

Logfiles

Hi All, I have a peculiar problem. I will call a script from another script. Script abc.ksh is called by ABC.ksh as ABC.ksh abc.ksh in abc.ksh I will create and redirect all the statements to log file. ABC.ksh will also has a log file. I want all the logs generated in file abc in ABC... (5 Replies)
Discussion started by: javeed7
5 Replies

6. UNIX for Advanced & Expert Users

logrotate with /etc/logrotate.conf file

Hi there, I want to rotate the logfiles which are located in /var/log/jboss/tomcat* so I have created a file named as 'tomat' in /etc/logrotate.d/tomcat with the following content. # cat /etc/logrotate.d/tomcat /var/log/jboss/tomcat_access_log*.log { daily nocreate ... (2 Replies)
Discussion started by: skmdu
2 Replies

7. UNIX for Dummies Questions & Answers

Gzip many logfiles in one time

Hi All, I am working on a script and i am now been stuck in the mid of it.. My Script actually list the files consuming large disk it need compress the log files.. Here are the files Hello_2009_10_22.log Hello_2009_10_23.log.gz Hello_2009_10_24.log.gz Hello_2009_10_22.log... (2 Replies)
Discussion started by: sumithra
2 Replies

8. Shell Programming and Scripting

Logrotate - I am not able to rotate files using logrotate

I have written script which is working in Home directory perfectly and also compressing log files and rotating correctly. But, when i try to run script for /var/log/ i am able to get compressed log files but not able to get rotation of compressed log files. Please suggest. I am using below command... (5 Replies)
Discussion started by: VSom007
5 Replies

9. AIX

Logrotate - /etc/logrotate.conf does't exist

Hi Admins. I have installed logrotate rpm on Aix 6.1. After the installation of rpm, I don't find /etc/logrotate.conf file and /etc/logrotate.d dir . The config file is located in /opt/freeware/etc/logrotate.conf. When I ran logrotate -v /opt/freeware/etc/logrotate.conf I get below... (2 Replies)
Discussion started by: snchaudhari2
2 Replies

10. Shell Programming and Scripting

Logrotate.d for every httpd instance for loop?

/etc/logrotate.d -rwxr-xr-x 1 root root 263 Aug 28 23:17 httpd-stooffsprod -rwxr-x--- 1 root root 273 Jul 10 2015 httpd-mwsi2hprodhist2 -rwxr-x--- 1 root root 261 Aug 11 17:28 httpd-mwsihist2 -rwxr-x--- 1 root root 269 Jul 20 2015 httpd-mwsiprodhist2 I need to figure out how to build a... (14 Replies)
Discussion started by: xgringo
14 Replies
httpd_rotatelogs_selinux(8)				  SELinux Policy httpd_rotatelogs			       httpd_rotatelogs_selinux(8)

NAME
httpd_rotatelogs_selinux - Security Enhanced Linux Policy for the httpd_rotatelogs processes DESCRIPTION
Security-Enhanced Linux secures the httpd_rotatelogs processes via flexible mandatory access control. The httpd_rotatelogs processes execute with the httpd_rotatelogs_t SELinux type. You can check if you have these processes running by exe- cuting the ps command with the -Z qualifier. For example: ps -eZ | grep httpd_rotatelogs_t ENTRYPOINTS
The httpd_rotatelogs_t SELinux type can be entered via the httpd_rotatelogs_exec_t file type. The default entrypoint paths for the httpd_rotatelogs_t domain are the following: /usr/sbin/rotatelogs PROCESS TYPES
SELinux defines process types (domains) for each process running on the system You can see the context of a process using the -Z option to ps Policy governs the access confined processes have to files. SELinux httpd_rotatelogs policy is very flexible allowing users to setup their httpd_rotatelogs processes in as secure a method as possible. The following process types are defined for httpd_rotatelogs: httpd_rotatelogs_t Note: semanage permissive -a httpd_rotatelogs_t can be used to make the process type httpd_rotatelogs_t permissive. SELinux does not deny access to permissive process types, but the AVC (SELinux denials) messages are still generated. BOOLEANS
SELinux policy is customizable based on least access required. httpd_rotatelogs policy is extremely flexible and has several booleans that allow you to manipulate the policy and run httpd_rotatelogs with the tightest access possible. If you want to allow all daemons to write corefiles to /, you must turn on the daemons_dump_core boolean. Disabled by default. setsebool -P daemons_dump_core 1 If you want to enable cluster mode for daemons, you must turn on the daemons_enable_cluster_mode boolean. Enabled by default. setsebool -P daemons_enable_cluster_mode 1 If you want to allow all daemons to use tcp wrappers, you must turn on the daemons_use_tcp_wrapper boolean. Disabled by default. setsebool -P daemons_use_tcp_wrapper 1 If you want to allow all daemons the ability to read/write terminals, you must turn on the daemons_use_tty boolean. Disabled by default. setsebool -P daemons_use_tty 1 If you want to deny any process from ptracing or debugging any other processes, you must turn on the deny_ptrace boolean. Enabled by default. setsebool -P deny_ptrace 1 If you want to allow all domains to use other domains file descriptors, you must turn on the domain_fd_use boolean. Enabled by default. setsebool -P domain_fd_use 1 If you want to allow all domains to have the kernel load modules, you must turn on the domain_kernel_load_modules boolean. Disabled by default. setsebool -P domain_kernel_load_modules 1 If you want to allow all domains to execute in fips_mode, you must turn on the fips_mode boolean. Enabled by default. setsebool -P fips_mode 1 If you want to enable reading of urandom for all domains, you must turn on the global_ssp boolean. Disabled by default. setsebool -P global_ssp 1 MANAGED FILES
The SELinux process type httpd_rotatelogs_t can manage files labeled with the following file types. The paths listed are the default paths for these file types. Note the processes UID still need to have DAC permissions. cluster_conf_t /etc/cluster(/.*)? cluster_var_lib_t /var/lib/pcsd(/.*)? /var/lib/cluster(/.*)? /var/lib/openais(/.*)? /var/lib/pengine(/.*)? /var/lib/corosync(/.*)? /usr/lib/heartbeat(/.*)? /var/lib/heartbeat(/.*)? /var/lib/pacemaker(/.*)? cluster_var_run_t /var/run/crm(/.*)? /var/run/cman_.* /var/run/rsctmp(/.*)? /var/run/aisexec.* /var/run/heartbeat(/.*)? /var/run/cpglockd.pid /var/run/corosync.pid /var/run/rgmanager.pid /var/run/cluster/rgmanager.sk httpd_log_t /srv/([^/]*/)?www/logs(/.*)? /var/www(/.*)?/logs(/.*)? /var/log/glpi(/.*)? /var/log/cacti(/.*)? /var/log/httpd(/.*)? /var/log/nginx(/.*)? /var/log/apache(2)?(/.*)? /var/log/php-fpm(/.*)? /var/log/cherokee(/.*)? /var/log/lighttpd(/.*)? /var/log/suphp.log.* /var/log/thttpd.log.* /var/log/apache-ssl(2)?(/.*)? /var/log/cgiwrap.log.* /var/www/stickshift/[^/]*/log(/.*)? /var/www/miq/vmdb/log(/.*)? /var/log/roundcubemail(/.*)? /var/log/php_errors.log.* /var/log/dirsrv/admin-serv(/.*)? /var/lib/openshift/.log/httpd(/.*)? /var/www/openshift/console/log(/.*)? /var/www/openshift/broker/httpd/logs(/.*)? /var/www/openshift/console/httpd/logs(/.*)? /etc/httpd/logs root_t / /initrd FILE CONTEXTS
SELinux requires files to have an extended attribute to define the file type. You can see the context of a file using the -Z option to ls Policy governs the access confined processes have to these files. SELinux httpd_rotatelogs policy is very flexible allowing users to setup their httpd_rotatelogs processes in as secure a method as possible. STANDARD FILE CONTEXT SELinux defines the file context types for the httpd_rotatelogs, if you wanted to store files with these types in a diffent paths, you need to execute the semanage command to sepecify alternate labeling and then use restorecon to put the labels on disk. semanage fcontext -a -t httpd_rotatelogs_exec_t '/srv/httpd_rotatelogs/content(/.*)?' restorecon -R -v /srv/myhttpd_rotatelogs_content Note: SELinux often uses regular expressions to specify labels that match multiple files. The following file types are defined for httpd_rotatelogs: httpd_rotatelogs_exec_t - Set files with the httpd_rotatelogs_exec_t type, if you want to transition an executable to the httpd_rotatelogs_t domain. Note: File context can be temporarily modified with the chcon command. If you want to permanently change the file context you need to use the semanage fcontext command. This will modify the SELinux labeling database. You will need to use restorecon to apply the labels. COMMANDS
semanage fcontext can also be used to manipulate default file context mappings. semanage permissive can also be used to manipulate whether or not a process type is permissive. semanage module can also be used to enable/disable/install/remove policy modules. semanage boolean can also be used to manipulate the booleans system-config-selinux is a GUI tool available to customize SELinux policy settings. AUTHOR
This manual page was auto-generated using sepolicy manpage . SEE ALSO
selinux(8), httpd_rotatelogs(8), semanage(8), restorecon(8), chcon(1), sepolicy(8) , setsebool(8) httpd_rotatelogs 14-06-10 httpd_rotatelogs_selinux(8)
All times are GMT -4. The time now is 12:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy