Tagged Questions
0
votes
1answer
40 views
Review of a crontab script to add timestamps to minutely runs; any suggestions?
I've got a crontab job set to run minutely as such:
* * * * * /home/username/public_html/domain.tld/production/scripts/cron_runner.sh
My goal is to add some timestamps to output from cron so I can ...
0
votes
4answers
91 views
How to automatically clean up date stamped logs
I have an apache web server with various virtual hosts. Each virtual host logs to date stamped files using cronolog. The result is that I end up with a lot of files like this:
----rw-r-- 1 root ...
0
votes
1answer
45 views
I want to save events or logs grabbed using Inotify to a file
I need your help - using Inotify I am watching a directory for the changes like create, delete, rename and move. I want these event to be logged in a file and I want to run Inotify as a service.
7
votes
5answers
658 views
Log all commands run by admins on production servers
It is company policy for admins to login to the servers via a personal username, and then run sudo -i to become root. Upon running sudo -i, sudo will create an environmental variable called ...
2
votes
1answer
136 views
Sending output from php script called from bash script to syslog
Sending output from php script called from bash script to syslog
Im trying to create a bash script (to be called by a cron job) which calls a php file (which I have not made). Calling the php file is ...
1
vote
3answers
248 views
Make cron log rsync only if there was transfer
I have this crontab running every 5 minutes:
date >> ~/18/rsync.log
rsync -vaz user@r18:~/assets ~/18 >> ~/18/rsync.log 2>&1
It adds this to the log file every 5 minutes:
Thu ...
1
vote
1answer
195 views
logging with named pipes
I have a lot of code I need to daemonize that prints to standard out. I am thinking of using the following shell script to create a named pipe so I can nohup a process while redirecting its output to ...
5
votes
5answers
246 views
Not able to delete lot of files at once in linux
I have run the following command, from inside of these log folders. But it looks like each folder will take infinite time.
find . -type f -exec rm -v {} \;
rwxrwxr-x 2 root root ...
5
votes
6answers
2k views
how to write a script that only acts on new log entries
I feel like this should be a simple thing but I am having a hard time figuring it out.
I am trying to write a script that will monitor one of the apache log files and take some specific action. But ...
12
votes
5answers
3k views
Adding a timestamp to bash script log
I have a constantly running script that I output to a log file:
script.sh >> /var/log/logfile
I'd like to add a timestamp before each line that is appended to the log. Like:
Sat Sep 10 21:33:06 ...
0
votes
1answer
134 views
nginx logs move to backup location
I have 3 nginx web servers which make big access.log log files.
I configured logrotate to rotate them when the size reaches 100mb and gzip them.
now i would like to move all the *.gz files at night ...
6
votes
3answers
1k views
Logging a “persons” activity in Linux
So I've read many of the posts related to this and have just come up more confused than before. There are recommendations for various tools including ttyrec, snoopy, acct, rootsh, sudosh, ttyrpld, ...
5
votes
1answer
237 views
What to do if wget's progress:mega doen't cut it anymore?
I have script for downloading large files in a queue. Now I would really appreciate it, if I had a decent log. Specifying the -o or -a option is apparently specially made for that, however as of the ...
0
votes
1answer
104 views
Compare Error logs across service fleet, find unique errors
I'm looking for a tool where I can list the servers to check, the location of the file and it would return a list of the most common errors across those servers (say like 2 or 3 servers for report ...
2
votes
2answers
398 views
How do I clear history of the bash logs? Also, do not log any of my users' bash logs?
How do I do that?
I want to clear everything as well as not log anything from now on.
2
votes
2answers
197 views
Bash edit file and keep last 500 lines
I am looking to create a cron job that opens a directory loops through all the logs i have created and deletes all lines but keep the last 500 for example.
I was thinking of something along the lines ...
3
votes
1answer
194 views
How can I record the running time of particular commands in Linux (specifically bash)?
I'm trying to collect some stats on how much time is spent 'waiting' for certain fairly short running tasks so I can justify purchase of some automated tools. I've written bash function wrappers ...
0
votes
2answers
1k views
Bash snippet for apache error log to show what URLS are causing 404s?
I have a standard apache error log file. I would like to see what URLs are causing 404s, since I have moved this site around and I want to find bad links. Can anyone recommend a bash snippet that will ...
