Logrotate configuration


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Logrotate configuration
# 1  
Old 04-09-2014
Logrotate configuration

Hi all,
i would like to have a configuration on log rotate that will gzip my log files with date pattern %Y-%m-%d
move these files to an olddir, but i want to avoid that the logrotate removes my files from old dir newer than 180 days
i applyied this config
Code:
#logrotate config to compress files
/my/dir/test/*????-??-??* {
    compress
    daily
    dateformat _%Y-%m-%d
    maxage 180
    rotate 180
    missingok
    dateext
    notifempty
    size +1k
    olddir /my/dir/test/gzipped/
}

i thought it will work just fine,
but when i debug it with the option
Code:
logrotate -dv /etc/logrotate.d/test

it print that the logrotate is trying to rotate the same file 180 times
and is doing the same for all the files, but i shouldn't, and also it is removing the file.
can you help me guys on what i'm missing here.

P.S Sorry if this is not the correct section.

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by charli1; 04-09-2014 at 12:36 PM.. Reason: coded
# 2  
Old 04-10-2014
I would guess that your filepattern is also matching olddir, so it's rotating everything in there as well.
# 3  
Old 04-11-2014
Quote:
Originally Posted by CarloM
I would guess that your filepattern is also matching olddir, so it's rotating everything in there as well.
Thanks for the reply mate,
so you think i will resolve mu issue if i remove the last
Code:
*

on my date pattern match?
# 4  
Old 04-15-2014
Yes, assuming it still matches the files you do want to rotate.

But it is just a guess - try it and find out Smilie.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

When to use sharedscripts in a Logrotate Configuration?

Hello All, OS: SLES 11.3 x86_64 Should I be using the sharedscripts config command for my logrotate configuration, given the info below? I made it so the server sending the log data will do Syslog pushes of 3 types of logs to my SLES server, and all 3 logs will be written into the same... (3 Replies)
Discussion started by: mrm5102
3 Replies

2. Shell Programming and Scripting

Problem with logrotate

Hi, I have a problem with logrotate at Centos 7. My logrotate is configured with "rotate 0" to Apache logs, so it should never keep logs when rotating, just removing them and replacing by new empty ones at every rotation. But for some reason, once in a while, I see that logrotate is creating... (0 Replies)
Discussion started by: dado000
0 Replies

3. AIX

Logrotate.conf

Hey Admins, I have installed logrotate on AIX server. I want to configure it for 1. /var/log/messages – keep 90 days, i.e., weekly rotate 13 2. Syslog – keep 90 days i.e., weekly rotate 13 3. Wtmp – keep 90 days i.e., weekly rotate 13 4. Sulog – keep 90 days i.e., weekly rotate 13 What... (1 Reply)
Discussion started by: snchaudhari2
1 Replies

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

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

6. Red Hat

Logrotate on RHEL 5

Hi All, Can any one let me me know if i run /usr/sbin/logrotate /etc/logrotate.conf will it read the whole /var/log/messages or it just see the time stamp of message file & then rotate the logs. Just wants to know is logrotation based on messages file contents or messages file time stamp. ... (1 Reply)
Discussion started by: ajaincv
1 Replies

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

8. Linux

LogRotate

Hi I am trying to rotate specific log by using logrotate function in unix I have made following entry in the /etc/logrotate.conf file /var/log/testlog/debug_log { daily rotate 7 create compress } But only issue is that my other logs like /var/log/messages,... (2 Replies)
Discussion started by: SiddhV
2 Replies

9. UNIX for Advanced & Expert Users

Logrotate configuration problem

Hi, I have the following configuration file: /logs/system/mindundi/* { rotate 0 daily missingok sharedscripts postrotate find /logs/system/mindundi/ -name "*log" -mtime +15 -exec /bin/rm -f {} \; endscript } I want to save only... (6 Replies)
Discussion started by: mitchbcn
6 Replies

10. 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
Login or Register to Ask a Question