Sponsored Content
Full Discussion: Logrotate exclude log file
Top Forums UNIX for Beginners Questions & Answers Logrotate exclude log file Post 303005061 by Arnaudh78 on Friday 13th of October 2017 05:43:20 AM
Old 10-13-2017
Logrotate exclude log file

Hi all !

I've an issue to exclude a log file from logrotate, I tried this below:

Code:
/var/log/apache2/[!(*logfile_in_question*)]*.log {
        olddir /var/log/apache2/old
        missingok
        rotate 50
        compress
        copytruncate
        notifempty
        create 644 root root
}

I tried also:

Code:
/var/log/apache2/[!logfile_in_question]*.log

It doesn't work.. Can someone help me please ?Smilie

---------- Post updated 13-10-17 at 04:43 AM ---------- Previous update was 12-10-17 at 09:15 AM ----------

I solved my issue in adding these lines in the logrotate conf file:

Code:
        
prerotate
            bash -c "[[ ! $1 =~ log_in_question ]]"
endscript

Code:
/var/log/apache2/*.log {
        olddir /var/log/apache2/old
        rotate 50
        compress
        copytruncate
        notifempty
        create 644 root root
        prerotate
            bash -c "[[ ! $1 =~ log_in_questiong ]] && [[ ! $1 =~ log_in_question2 ]]"
        endscript
}

Bye ! Smilie
 

10 More Discussions You Might Find Interesting

1. 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

2. UNIX for Advanced & Expert Users

how to logrotate log files

Hi, I have written a script that runs every five minutes in cron schedular. The Operating system is Fedora core 9. This script generates 2 log files, these log file size is increasing as some log data is being dumped into these 2 log files every five minutes. I need to logrotate these 2 files.... (1 Reply)
Discussion started by: renuka
1 Replies

3. UNIX for Advanced & Expert Users

rotate modsec log with logrotate in the global configuration

Hello Experts, I have an apache 2.2.17 on solaris 10 that I am not sure if I, could list the following in the global settings in httpd.conf. I tested it in the Virtual host section of httpd.conf and, it works but, not sure if I can do it in the global settings. Any help would be greatly... (0 Replies)
Discussion started by: afadaghi
0 Replies

4. Ubuntu

[Solved] Using Find with an exclude/exclude file

I am familiar with using tar and exclude/include files: tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion but was wondering if I could use find in the same way. I know that you can just specify the directories to exclude but my list is... (2 Replies)
Discussion started by: metallica1973
2 Replies

5. Debian

Logrotate truncated my log files to 0 bytes and no logs are written

Hi, Yesterday I installed and configured logrotate on my Debian machine. I was expecting this to run at 06:25 in the morning and it actually did. All my old logs were compressed and zipped but the new logs were all with size equal to 0 bytes. Processes, while still running ok, they were not... (2 Replies)
Discussion started by: pmatsinopoulos
2 Replies

6. Shell Programming and Scripting

Help needed on Perl Script to Handle Log files that are rotated using logrotate

Hello all, I am working on a perl script which will read weblogic logfile and send the error messages to Zenoss Monitoring tool. At present the script works and it can able to send the error messages to Zenoss. The problem comes when the logrotate has been applied to the weblogic log file. At... (3 Replies)
Discussion started by: kar_333
3 Replies

7. UNIX for Dummies Questions & Answers

Explain this logrotate file

Very silly question .. I deleted it .. Please delete this thread too . (0 Replies)
Discussion started by: stunn3r
0 Replies

8. Red Hat

File is missing after logrotate!!

I am having a requirement to rotate the my application logs dailay as it is keep on writiing to single file and below is the logrotate function which I am using, cat /apps/bmc/bmtm/QPasa_logrotate.conf /apps/bmc/bmtm/all_events.log /apps/bmc/bmtm/history_association.log { missingok ... (1 Reply)
Discussion started by: sandyrajh
1 Replies

9. 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

10. 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
log(3M) 						  Mathematical Library Functions						   log(3M)

NAME
log, logf, logl - natural logarithm function SYNOPSIS
cc [ flag... ] file... -lm [ library... ] #include <math.h> double log(double x); float logf(float x); long double logl(long double x); DESCRIPTION
These functions compute the natural logarithm of their argument x, loge(x). RETURN VALUES
Upon successful completion, log() returns the natural logarithm of x. If x is +-0, a pole error occurs and log(), logf(), and logl() return -HUGE_VAL, -HUGE_VALF, and -HUGE_VALL, respectively. For finite values of x that are less than 0, or if x is -Inf, a domain error occurs and a NaN is returned. If x is NaN, a NaN is returned. If x is 1, +0 is returned. If x is +Inf, x is returned. For exceptional cases, matherr(3M) tabulates the values to be returned by log() as specified by SVID3 and XPG3. ERRORS
These functions will fail if: Domain Error The finite value of x is negative, or x is -Inf. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, the invalid floating-point exception is raised. The log() function sets errno to EDOM if the value of x is negative. Pole Error The value of x is 0. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, the divide-by-zero floating-point exception is raised. USAGE
An application wanting to check for exceptions should call feclearexcept(FE_ALL_EXCEPT) before calling these functions. On return, if fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an exception has been raised. An application should either examine the return value or check the floating point exception flags to detect exceptions. An application can also set errno to 0 before calling log(). On return, if errno is non-zero, an error has occurred. The logf() and logl() functions do not set errno. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
exp(3M), feclearexcept(3M), fetestexcept(3M), isnan(3M), log10(3M), log1p(3M), math.h(3HEAD), matherr(3M), attributes(5), standards(5) SunOS 5.10 1 Sep 2002 log(3M)
All times are GMT -4. The time now is 10:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy