#!/bin/bash LOGFILE=/var/log/backup.log backup_source="/home" backup_dest="/home/sean" date=`date '+%d-%B-%Y'` hostname=$(hostname -s) filename="$hostname-$date.tgz" echo "Backing Up your Linux System" tar cvpzf $backup_dest/$filename $backup_source LOGFILE="log-$date.log" log(){ message="$@" echo $message echo $message >>$LOGFILE } log "$LOGFILE" log | tee install.log echo "Backup finished" echo "$LOGFILE" hie I'm trying append teh files i have backed up into log file. All i get is a blank logfile. This what i have so far

Member Avatar
Member Avatar
+0 forum 2

In working on a logfile for an application, I needed to limit the size of the logfile to 1000 bytes. Since it is not possible to delete lines from a file in C++, I used the following steps: Rename the logfile to a temporary name. Read the temporary file. Write the last 1000 bytes to a new logile. Delete the temporary file. I tested my code on another machine (location: Desktop) and it worked perfectly. When I tested the exact same code inside the application (location of the logfile: /var/HHPVideoServer/log.txt, application is run as sudo), it has no effect. Here …

Member Avatar
Member Avatar
+0 forum 3

Hi All, Need to Analyze Zimbra Mail server sync.log through shell script Required output from sync.log Total Number of Users : Total Number of Device ID: Total Number of Device Type with Version : Below is Sample of Log File : 2009-12-16 00:00:43,970 INFO [btpool0-12194://webmail.amit.com/Microsoft-Server-ActiveSync?Cmd=Ping&User=rahul%40kke.amit.com&DeviceId=androidc986729649&DeviceType=Android] [] sync - POST Microsoft-Server-ActiveSync?Cmd=Ping&User=ritesh%40kke.amit.com&DeviceId=androidc986729649&DeviceType=Android 2009-12-16 00:00:43,971 INFO [btpool0-12194://webmail.amit.com/Microsoft-Server-ActiveSync?Cmd=Ping&User=mohan%40kke.amit.com&DeviceId=androidc986729649&DeviceType=Android] [] sync - DeviceID=androidc986729649; DeviceType=Android; UA=Android/0.3; Protocol=12.0; PolicyKey=null 2009-12-16 00:00:43,971 INFO [btpool0-12194://webmail.amit.com/Microsoft-Server-ActiveSync?Cmd=Ping&User=rahul%40kke.amit.com&DeviceId=androidc986729649&DeviceType=Android] [name=rahul@kke.amit.com;mid=3041;Cmd=Ping;DeviceID=androidc986729649;Version=12.0;] sync - Response size 13 bytes 2009-12-16 00:00:43,971 INFO [btpool0-12194://webmail.amit.com/Microsoft-Server-ActiveSync?Cmd=Ping&User=rahul%40kke.amit.com&DeviceId=androidc986729649&DeviceType=Android] [name=rahul@kke.amit.com;mid=3041;Cmd=Ping;DeviceID=androidc986729649;Version=12.0;] sync - HTTP/1.1 200 OK 2009-12-16 00:00:47,278 INFO [btpool0-12161://webmail.amit.com/Microsoft-Server-ActiveSync?Cmd=Ping&User=hotblast%40amit.com&DeviceId=Moxier359496033451946&DeviceType=MoxierAndroid] [] sync - POST Microsoft-Server-ActiveSync?Cmd=Ping&User=hotblast%40amit.com&DeviceId=Moxier359496033451946&DeviceType=MoxierAndroid Thanks in Advance Amit

Member Avatar
Member Avatar
+0 forum 1

In writing a logfile program, I need a function to output the log entries between two dates. I use [ICODE]seekg()[/ICODE] and [ICODE]tellg()[/ICODE] to save the position of the first entry to output and last entry and then go back later to output the data in between. However, [ICODE]seekg()[/ICODE] when told to seek back to the beginning position goes to position -1 (can be seen when ran through a debugger), and no output is created. seekg() works fine when seeking in other parts of the program. [CODE]#include <fstream> #include <time.h> #include <string> #include <sys/stat.h> #include <iostream> #include <stdbool.h> #include <cstdlib> struct …

Member Avatar
Member Avatar
+0 forum 1

In writing a logger for an application, the datestamp ends up adding a new line. The datestamp function is as follows: [CODE]string log_class::get_time() { time_t rawtime; time (&rawtime); string timestamp; timestamp = (ctime (&rawtime)); return timestamp; } [/CODE] This outputs something like [ICODE]Tue Sep 6 14:58:35 2011[/ICODE], but when called in the main function with [ICODE]logfile << get_time() << " " << logmessage_to_write << endl;[/ICODE], it produces a newline after the datestamp like: [CODE]Tue Sep 6 14:58:35 2011 data goes here[/CODE] I would like it to be on one line, as in [ICODE]Tue Sep 6 14:58:35 2011 data goes here[/ICODE], …

Member Avatar
Member Avatar
+0 forum 5

I have multiple servers running Centos 5.5 or later, some of them have syslogs with date stamps like: Sep 1 05:12:36 and some of them like: 2011-09-04T09:21:42.442689-07:00. I would really like to get them all the same so the same analysis scripts can be used, but I have not been able to identify where the date formatting is set. Someone please help. I have already spent much to much time on this. Thanks

Member Avatar
Member Avatar
+0 forum 2

Hi, I want to create a log file that captures all the actions happening...anyway i got code for that from internet. Now what i want to do is, make that [COLOR="Red"][U][B]file read only[/B][/U][/COLOR] so that the data is not modified by external application or user. [code=c++]log(char* msg) { time_t now = time(0); struct tm* tm = localtime(&now); ofstream out( "logfileBrandNew.log",ios::app); out << tm->tm_year << '/' << tm->tm_mon << '/' << tm->tm_mday << ' ' << tm->tm_hour << ':' << tm->tm_min << ':' << tm->tm_sec << ": "; out << msg << "\n"; out.close(); }[/code] How to achieve this using c++ …

Member Avatar
Member Avatar
+0 forum 11

So I've got some lines in my richtextbox, but when i click btnSaveLog, it saves, but everything is on one line... I have to use a richtextbox to show all info. I've seen it does show the lines with Wordpad, but i'm saving it as a *.log file, so i'm using notepad. Any solutions for this problem? Code: TextWriter stwLog = new StreamWriter("data.log"); stwLog.WriteLine(richTextBox1.Text); stwLog.Close();

Member Avatar
Member Avatar
+0 forum 8

Hi- My brother gave me his old laptop, but it's really slow. I got a Hijack This report to see what could be slowing it down but I don't know much about computers. Can anyone take a look at this and help me out? ---- Logfile of Trend Micro HijackThis v2.0.2 Scan saved at 4:21:20 PM, on 10/19/2009 Platform: Windows XP SP3 (WinNT 5.01.2600) MSIE: Internet Explorer v7.00 (7.00.6000.16915) Boot mode: Normal Running processes: C:\WINDOWS\System32\smss.exe C:\WINDOWS\system32\winlogon.exe C:\WINDOWS\system32\services.exe C:\WINDOWS\system32\lsass.exe C:\WINDOWS\system32\svchost.exe C:\Program Files\Windows Defender\MsMpEng.exe C:\WINDOWS\System32\svchost.exe C:\WINDOWS\system32\spoolsv.exe C:\WINDOWS\Explorer.EXE C:\Program Files\Common Files\ArcSoft\Connection Service\Bin\ACService.exe C:\Program Files\Common Files\Apple\Mobile Device Support\bin\AppleMobileDeviceService.exe C:\PROGRA~1\AVG\AVG8\avgwdsvc.exe C:\Program Files\Java\jre6\bin\jqs.exe C:\Program Files\Common Files\LightScribe\LSSrvc.exe …

Member Avatar
+0 forum 0

Back even a few years ago, it was popular to use log files to ascertain web analytics. Now, most companies use a javascript tag that the web analytic tool picks up. Hence, do you still rely on logfiles? Or do you forget it even exists?

Member Avatar
+0 forum 0

The End.