LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-04-2011, 04:02 PM   #1
slufoot80
Member
 
Registered: Nov 2011
Posts: 69

Rep: Reputation: Disabled
logrotate or logrotate.conf; problems with sftp


Ok I am setting up the "logrotate.conf" file, see below

/var/log/messages
{

prerotate
scp /frank/*.gz root@192.168.1.20:/frank/20`date +%y`/`date +%b`
endscript

daily
missingok
rotate 0
copytruncate
dateext
compress
maxage 36500
olddir /frank
postrotate
# scp /frank/*.gz root@192.168.1.20:/frank/20`date +%y`/`date +%b`
pkill -HUP rsyslogd
endscript
}
the problem when I get to the end of the month it will put the last file dated 10/31 in the "/Nov" directory. do I run "scp" out of the brackets in a global setting or do I keep them in there for a local setting
 
Old 11-05-2011, 07:50 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by slufoot80 View Post
when I get to the end of the month it will put the last file dated 10/31 in the "/Nov" directory.
Because
Code:
eval echo "20`date +%y`/`date +%b`"
results in "2011/Nov" at time of this logrotate scripts execution?


Quote:
Originally Posted by slufoot80 View Post
do I run "scp" out of the brackets in a global setting or do I keep them in there for a local setting
If the action is local to these log files only keep it here, OTOH


Quote:
Originally Posted by slufoot80 View Post
Code:
prerotate
 scp /frank/*.gz root@192.168.1.20:/frank/20`date +%y`/`date +%b`
endscript
...why should you do this in the first place? You don't have to scp as root because Rsyslogd has templates for logs. So if you can install it on 192.168.1.20 then you can send /var/log/messages there and process it further as you like. And BTW,
Code:
20`date +%y`/`date +%b`
can be written as
Code:
`date +'%Y/%b'`
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
logrotate dnaqvi Linux - General 3 04-20-2010 04:36 PM
Changes to my logrotate.conf file do I need to reboot? mccartjd Linux - Newbie 5 01-08-2010 01:28 AM
parameter /etc/logrotate.conf vikas027 Linux - Server 2 04-16-2009 08:28 AM
Logrotate causing all sorts of problems: trscookie Linux - Software 1 05-03-2007 10:54 AM
Logrotate conf: unexpted text TruckStuff Linux - General 4 06-18-2003 08:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration