Shell to cleanup Linux logs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell to cleanup Linux logs
# 1  
Old 10-29-2017
Shell to cleanup Linux logs

Hi,Looking for any generic shell scripts to cleanup systemlogs.

Thanks

Last edited by tommy812; 12-01-2017 at 02:35 AM..
# 2  
Old 10-29-2017
Have a look at the logrotate utility.

“Log rotation” refers to the practice of archiving an application's current log, starting a fresh log, and deleting older logs. The system usually runs logrotate once a day, and when it runs it checks rules that can be customized on a per-directory or per-log basis.
This User Gave Thanks to Chubler_XL For This Post:
# 3  
Old 10-30-2017
Quote:
Originally Posted by Chubler_XL
Have a look at the logrotate utility.

“Log rotation” refers to the practice of archiving an application's current log, starting a fresh log, and deleting older logs. The system usually runs logrotate once a day, and when it runs it checks rules that can be customized on a per-directory or per-log basis.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell commands and ps and server logs

Good afternoon all!! I am writing a shell script that will generate a random phrase to be used as a password. this is the line I use to generate the password echo `head -n 10 /dev/urandom | tr -cd "*+,-/:;<=>?_" | cut -c '1-'$3` The third input in the command is the length of the password i... (6 Replies)
Discussion started by: cptkirkh
6 Replies

2. UNIX for Advanced & Expert Users

Linux logs

Hi, In which file I can see linux logs for logging, file creation & deletation, chenge permission, running servicese etc. I know it is difficult for individual identification. So can you suggest some basic files which helpful for monitoring & also they include logging of basic service as i... (1 Reply)
Discussion started by: Nishit
1 Replies

3. Shell Programming and Scripting

Shell script for capturing FTP logs

I have a script #!/bin/bash HOST=ftp.example.com USER=ftpuser PASSWORD=P@ssw0rd ftp -inv $HOST <<EOF user $USER $PASSWORD cd /path/to/file mput *.html bye EOF the script executes sucessfully I need to capture the FTP logs to a logfile should contain FTP Login successful ... (1 Reply)
Discussion started by: rajeshas83
1 Replies

4. Shell Programming and Scripting

Help with Shell Script to View Logs

Hi I'm very new to unix shell scripting. Im also new here in this forum. I'm a SQL Server DBA but I'm slowly learning Oracle and Sybase DB. Our Oracle and Sybase are on Unix platforms. Im slowly learning Linux Admin and Shell Scripting to automate tasks. I'm writing a script to view DB error... (4 Replies)
Discussion started by: Ricky777
4 Replies

5. UNIX for Dummies Questions & Answers

Best way to publish logs and reports from shell scripts?

Hello, I have been searching for some advice on this. I'm new to linux in a sys-admin kind of role, and I'm often asked to get information by running basic commands in the linux shell. For example, how many jobs running, grep a number of files, run a random program and output the results,... (4 Replies)
Discussion started by: allagher8
4 Replies

6. Shell Programming and Scripting

Managing logs in shell script

Hi, I need write a shell script which should be executed from the crontab every day. This shell script is running several other shell scripts , and each one of them is writing to its log file. Few of the the shell script are also connecting using ssh to some other users on remote machine , do... (1 Reply)
Discussion started by: Yoav
1 Replies

7. Red Hat

collect red hat linux error logs

Hi, I have two questions,first of all is where can I collect more error logs(the log under /var/log/messages), also give the corresponding explain is grateful.The second one is the log under various versions(such as red hat,suse,etc) is the same or not. Thanks for answers. (1 Reply)
Discussion started by: zhaoyy
1 Replies

8. Shell Programming and Scripting

Shell Script for GC Logs

Hi, I have a strange situation here, I want to archive gc.logs file, generated by a java application, the strange thing about gc.log file is is doesn't have any time/date stamp appended to it unlike other logs (catalina/access/error) and one more strange thing is when ever the application is... (6 Replies)
Discussion started by: Neeryan
6 Replies

9. Programming

Application Cleanup during Linux Shutdown

I'm trying to do some cleanup (write open files) when Linux shuts down. I thought the right method would be to trap SIGTERM and do the necessary processing. Here's my sample code: #include <stdio.h> // for File I/O #include <signal.h> // for signals #include <unistd.h> // for sleep() void... (6 Replies)
Discussion started by: whatisron
6 Replies

10. Linux

FTP Logs in Linux/Unix

Hi, I need to get a hostory of users who FTP into a server. How can I do it in Linux/Unix? Is there a command for this? I do not want to use netstat -a as it gives only the list of users who have a session currently on the server. Can this be done with the "last" command? Please do let me... (0 Replies)
Discussion started by: manisendhil
0 Replies
Login or Register to Ask a Question