LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Redirecting one output to another file (https://www.linuxquestions.org/questions/linux-server-73/redirecting-one-output-to-another-file-861655/)

amjadask 02-09-2011 12:37 PM

Redirecting one output to another file
 
hi
i have installed squid proxy server in rhel
and am continuously monitoring the log messages in /var/log/squid/access.logs in that i search only TCP_DENIED through grep command
i want to redirect or copy that TCP_DENIED messages to a file can u help me out how should i copy or redirect denid messages in a file


if there is any possibilities to redirect messages by date by date please tell me the solution
i need it urgently please help me out

szboardstretcher 02-09-2011 12:40 PM

Something like this?

Code:

grep TCP_DENIED /var/log/squid/access.logs >> /tmp/output.txt

amjadask 02-10-2011 01:18 AM

thanqs alot i got the solution i have one more query can i run cronjobs for particular time like 14:00-16:00 hrs
i want to copy denied messages, is it possibl,e give me the solution
thanks&regards

szboardstretcher 02-14-2011 11:21 AM

Quote:

Originally Posted by amjadask (Post 4253787)
thanqs alot i got the solution i have one more query can i run cronjobs for particular time like 14:00-16:00 hrs
i want to copy denied messages, is it possibl,e give me the solution
thanks&regards


To run the command every 15 minutes (*/15) and between the hours of 2 and 4 (14-16) you can add this to your crontab by running "crontab -e"

Code:

*/15 14-16 * * * grep TCP_DENIED /var/log/squid/access.logs >> /tmp/output.txt


All times are GMT -5. The time now is 03:45 PM.