Dan,

The following script may be useful, via CRON
--
/mnt/kd/bin/truncate-lines 2000 /var/log/lighttpd/ssl-access.log
--
should do the trick.

File: /mnt/kd/bin/truncate-lines
--
#!/bin/sh

## truncate a file, in-place, keeping the last keep_lines lines
##
## Usage: truncate-lines keep_lines filename

if [ $# -ne 2 ]; then
  echo "Usage: truncate-lines keep_lines filename" >&2
  exit 1
fi

keep_lines="$1"
filename="$2"

if [ ! -f "$filename" ]; then
  echo "truncate-lines: Can't open file: $filename" >&2
  exit 1
fi

lines="$(wc -l "$filename" | awk '{ print $1; }')"

if [ $lines -gt $keep_lines ]; then
  del_lines=$(($lines - $keep_lines))
  sed -i "1,$del_lines d" "$filename"
fi
--

Lonnie


On Jul 22, 2011, at 5:52 PM, Dan Ryson wrote:

> Hi Lonnie,
> 
> CRON.  Of course!   That's a perfect solution.   
> 
> And I'll rest easier knowing that I'm not killing my flash memory.
> 
> Thanks for the suggestions and the prompt reply.
> 
> Dan
> 
> -----Original Message-----
> From: Lonnie Abelbeck [mailto:li...@lonnie.abelbeck.com] 
> Sent: Friday, July 22, 2011 5:53 PM
> To: AstLinux Users Mailing List
> Subject: Re: [Astlinux-users] SSL-Access.log
> 
> Hi Dan,
> 
> Yes, "/var/log/lighttpd/ssl-access.log" is on RAM with a 5MB partition for
> all of /var (note asterisk /var stuff is not in RAM).
> 
> Would a nightly removal of "/var/log/lighttpd/ssl-access.log" via CRON do
> the trick?  Maybe back off the query interval to 30 or 40 seconds?
> 
> I suspect there is a way to disable SSL logging in lighttpd, but I can't
> find it at the moment.
> 
> I'd try to manage the log file via cron to < 1MB.
> 
> Lonnie
> 
> 
> On Jul 22, 2011, at 3:55 PM, Dan Ryson wrote:
> 
>> All,
>> 
>> We have a handful of Polycom phones with the built-in microbrowser.  
>> Earlier this week, I hacked together a (truly ugly) PHP script that 
>> generates a poor-man's busy lamp field in the phones' idle browser.  
>> The phones query Asterisk for an update once every twenty seconds.  
>> Since some of our phones are off-site, I wanted the browser to access
> using HTTPS.
>> 
>> Until this afternoon, everything was working pretty well.  I then 
>> noticed that the messages log had quit working.  Upon further 
>> investigation, I found the /var partition full to the brim with 
>> several days of ssl-access.log entries.  DF reported /var at 100% use; 
>> 0 available.  In the effort to temporarily buy some relief, I deleted the
> ssl-access.log file.  Sadly, DF
>> is still reporting /var to be full.   
>> 
>> With that as background, I hope you'll share your thoughts or help me 
>> with these questions...
>> 
>> * - Do you think an after-business-hours reboot will solve the 
>> immediate problem with /var being full?
>> * - Do I have to worry about burning up the CF card with log entries?  
>> (My understanding is that's in RAM.)
>> * - Is there some way to selectively defeat log entries for this 
>> script so /var doesn't fill?
>> 
>> Thanks!
>> 
>> Dan
>> 
>> 
>> 
>> ----------------------------------------------------------------------
>> --------
>> 10 Tips for Better Web Security
>> Learn 10 ways to better secure your business today. Topics covered
> include:
>> Web security, SSL, hacker attacks & Denial of Service (DoS), private 
>> keys, security Microsoft Exchange, secure Instant Messaging, and much
> more.
>> http://www.accelacomm.com/jaw/sfnl/114/51426210/
>> _______________________________________________
>> Astlinux-users mailing list
>> Astlinux-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/astlinux-users
>> 
>> Donations to support AstLinux are graciously accepted via PayPal to
> pay...@krisk.org.
>> 
>> 
> 
> 
> ----------------------------------------------------------------------------
> --
> 10 Tips for Better Web Security
> Learn 10 ways to better secure your business today. Topics covered include:
> Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
> security Microsoft Exchange, secure Instant Messaging, and much more.
> http://www.accelacomm.com/jaw/sfnl/114/51426210/
> _______________________________________________
> Astlinux-users mailing list
> Astlinux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/astlinux-users
> 
> Donations to support AstLinux are graciously accepted via PayPal to
> pay...@krisk.org.
> 
> 
> 
> ------------------------------------------------------------------------------
> 10 Tips for Better Web Security
> Learn 10 ways to better secure your business today. Topics covered include:
> Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
> security Microsoft Exchange, secure Instant Messaging, and much more.
> http://www.accelacomm.com/jaw/sfnl/114/51426210/
> _______________________________________________
> Astlinux-users mailing list
> Astlinux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/astlinux-users
> 
> Donations to support AstLinux are graciously accepted via PayPal to 
> pay...@krisk.org.
> 
> 


------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
Astlinux-users mailing list
Astlinux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
pay...@krisk.org.

Reply via email to