Solved

FreeBSD Logrotate and FTP

Posted on 2014-01-10
15
860 Views
Last Modified: 2016-02-11
I am not a FreeBSD or Linux expert--quickly becoming so--and I have a server that generates large and frequent FreeRADIUS detail files. I was told that there is an built-in logrotate in FreeBSD, but my machine (inherited) doesn't have it. I need to install that, and then either have a log rotation to save disk space, or have a way to send the files--then delete them from the server--to a jumpbox to be accessed by ftp by other IT people who don't have access to the server. Is this possible? and how would it be done?

Thanks
0
Comment
Question by:RDM1776
  • 6
  • 5
  • 4
15 Comments
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 39772947
I'm also learning through experience with FreeBSD and From a similar situation I found rsyslog. It takes over syslog and can also pull log files if you can't write using syslog directly. Then I added the elasticsearch output module and push to an elasticsearch setup on centos that was super easy to create. From there you can use kibana or whatever you want to view the logs.

I know this isn't exactly what you asked about but I hope my limited experience can help in this area. If you need any more details I have notes of everything I did and config files.
0
 

Author Comment

by:RDM1776
ID: 39773380
Yes, I'd like to see what you have, it might work to give me an alternative solution.
0
 
LVL 61

Expert Comment

by:gheist
ID: 39773782
BSD never had logrotate.
nesyslog is rotating logs and has good manuals (even less one might replace system's default logger with something blurry and unsecure)
0
 
LVL 38

Assisted Solution

by:Aaron Tomosky
Aaron Tomosky earned 500 total points
ID: 39773826
Here are my notes installing rsyslog on FreeBSD
/////////////////////////////////////replace syslog with rsyslog
cd /usr/ports/sysutils/rsyslog7
//add the RELP as we may use that to send to another rsyslog
make install clean
//To start using rsyslogd, stop syslogd if it's running:
/etc/rc.d/syslogd stop

//And add the following lines to /etc/rc.conf:
syslogd_enable="NO"
rsyslogd_enable="YES"

//newsyslog has the path of syslogd's pid file hardcoded. To make it work seamlessly with rsyslog, add this:
rsyslogd_pidfile="/var/run/syslog.pid"

//I copied /etc/syslog.conf to start
cp /etc/syslog.conf /usr/local/etc/rsyslog.conf
//the added the three modules suggested and change the !ppp to an if statement
$ModLoad immark.so   # provides --MARK-- message capability
$ModLoad imuxsock.so # provides support for local system logging
$ModLoad imklog.so   # kernel logging

 if $programname == 'ppp' then {
*.*                                             /var/log/ppp.log
}



I'll send the rest when I'm at a computer
0
 
LVL 61

Expert Comment

by:gheist
ID: 39773922
I wonder how that eventually can do any log rotation at all

pkg_add -r syslog-ng rsyslog
might be much faster and leave less dirt on the disk...
0
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 39774051
Rsyslog has an elasticsearch output module. Like I said before, pushing to that is all I have experience with and the author asked to see it
0
 
LVL 61

Expert Comment

by:gheist
ID: 39774400
detail files is essentially logs by radius clients.
you can replace them with syslog, and plainly disable detail listener.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:RDM1776
ID: 39777256
Or simply, is there an elegant way to just scp these files to another server that isn't quite as locked down, and just have a cron job that periodically deletes the files?
0
 
LVL 61

Expert Comment

by:gheist
ID: 39777354
Maybe not create them first hand...
0
 
LVL 61

Expert Comment

by:gheist
ID: 39777379
Well freebsd has cron too...
0
 
LVL 38

Assisted Solution

by:Aaron Tomosky
Aaron Tomosky earned 500 total points
ID: 39777423
if you write an .sh script that does the copy and delete, then you just add that script to cron. Might want to make sure in the script the files are actually copied before deleting.
0
 

Author Comment

by:RDM1776
ID: 39782196
I am so new at server management it is not funny. That said, I like that idea of a script, but I would need at least an example so that I have an idea of where to go with it.
0
 
LVL 61

Expert Comment

by:gheist
ID: 39783731
The detail files come from remote devices
You can dysable them on remote devices while converting logging to syslog.
0
 
LVL 38

Accepted Solution

by:
Aaron Tomosky earned 500 total points
ID: 39789228
Basically anything you do on the command line can go into a .sh script. Just remember to mark it as executable with chmod.
So search for instructions on how to ftp and copy from the command line and you can make a script.

That said, sending the logs directly to syslog instead of a file is a much better solution.
0
 

Author Closing Comment

by:RDM1776
ID: 39792769
These are decent directions to search to help me solve the issue. I'll have to research more and decide how to do it. Thanks
0

Featured Post

New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

Join & Write a Comment

Suggested Solutions

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
AWS Glacier is Amazons cheapest storage option and is their answer to a ‘Cold’ storage service.  Customers primarily use this service for archival purposes and storage of infrastructure backups.  Its unlimited storage potential and low storage cost …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now