38 users online (0 members and 38 guests)  

Thread: Need Help


  Results 1 to 4 of 4
  1. #1
    cyds's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2006
    Posts
    2

    Need Help

    Hello,

    Who could write me a script which will contact to all new added folder/log.txt`s and read some sort of lines and then put them to the web.

    for example:

    read line [ became an admin. nick: Test. Time: 05.09.2006 17:50 ]

    and but this line to web: http://test.com/cheks

    OS: linux Gentoo

    Thanks a lot.

  2. #2
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: Need Help

    Why not just browse to the log file?
    http://.../log.txt will display the contents as a readable page in most borwsers.
    Last edited by HTML; 03-20-2007 at 08:38 PM.

  3. #3
    cyds's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2006
    Posts
    2

    Re: Need Help

    Quote Originally Posted by DeadMeatGF
    Why not just browse to the log file?
    http://.../log.txt will display the contents as a readable page in most borwsers.
    in this log many other information that no need. I need on some lines in log.
    Last edited by HTML; 03-20-2007 at 08:39 PM.

  4. #4
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: Need Help

    I run a logger on a server. This is what I did:

    run BitchX configured to log.
    run a cron job at 00:00 that calls a script I wrote.
    Code:
    #! /usr/bin/perl
    # BitchX log rotator, converter & poster
    #
    
    ($DAY, $MONTH, $YEAR) = (localtime) [3, 4, 5];
    $YEAR   = $YEAR + 1900;
    $MONTH  = $MONTH + 1;
    
    if ($MONTH < 10) {$MONTH = "0" . $MONTH};
    if ($DAY < 10) {$DAY = "0" . $DAY};
    
    $today          = $YEAR . $MONTH . $DAY;
    $log            = $today . ".log";
    $file           = $today . ".txt";
    $oldfile        = "/home/username/.BitchX/logs/#channel.log";
    $newfile        = "/home/username/public_html/logs/$file";
    $logfile        = "/home/username/public_html/logs/$log";
    
    use File::Copy;
    copy($oldfile, $logfile);
    
    `rm $oldfile`;
    `echo >> $logfile`;
    `date >> $logfile`;
    `echo >> $logfile`;
    `todos < $logfile > $newfile`;
    
    unlink($logfile) or die;
    tada!
    lynx mydomain.com/~username/logs gives a list of files (i.e. for today the file would be 20060805.txt)
    a couple of days after the first of the month i'll tar everything up.
    tar zcvf 200608.tgz 200608*.txt

    is this what you're looking for? I know this is perl, but it's what i was using at the time. it shouldn't be too hard to add some matching statements to strip out what you want to put in the file.

    U
    Last edited by uthus; 09-05-2006 at 09:24 PM.