Forum Discussion

colbeseder_1156's avatar
colbeseder_1156
Icon for Nimbostratus rankNimbostratus
May 29, 2013

Delete individual logs - iRule

I want to send emails from my iRule. And I am and it's working.

 

I have an iRule that writes logs. I have an alert that sends an email when it sees a matching log. So far, so good.

 

But I don't want my log file to be full of these emails. So in my alert, I also want to delete the log. I'm doing it like this:

 

exec command="sed -i 's/.*SENDMAIL.*[\r\n]*//' /var/log/ltm";

 

This does remove the line. But then I can't write any more logs. Why is that and how can I prevent / fix it?

 

1 Reply

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    Basically you're rewriting the ltm logfile and creating a new one. Meanwhile the logs are still going to the old file.

     

    I'd add some logic to your alerting myself to make sure you track when the last alert was sent, and only send one per XX minutes...

     

    H