LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-09-2012, 12:25 PM   #16
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965

Quote:
Originally Posted by Satyaveer Arya
yesterday whole night I tried this above script running manually. It was taking long enough to generate a weekly report. The script took around 5 hrs and keeps on running even then and never ended with a result.. What could be the problem?
Once again:These things apply to ALL problems, not just shell scripts. Walk through things one step at a time, and figure out what's wrong. Again, you have been given the solution several times. Also, have you bothered to read the sarg man page? Perhaps look at the "-o" option, that TELLS SARG WHERE TO WRITE THE REPORT, which you haven't done yet.

Quote:
Originally Posted by Cedrik View Post
Sorry, but can you understand this:

कार्यक्रम एक फाइल में उत्पादन का उत्पादन

Nice one, Cedrik.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-09-2012, 01:45 PM   #17
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 852

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
For some reason, this conversation is starting to remind me of the first episode of Red Dwarf.

Quote:
Originally Posted by Satyaveer Arya View Post
I can understand this, but what exactly you want to say?
It's redirected to a file, Dave. Stdout is redirected to a file. Stderr is redirected to a file. All output is redirected to a file. Everything is redirected to a file, Dave.
(Sorry, couldn't resist)
 
2 members found this post helpful.
Old 02-10-2012, 03:17 PM   #18
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Original Poster
Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Hi TBOne,

Today I tried this script to generate weekly report:

Quote:
#!/bin/bash
LOG_FILES=
if [ -s /var/log/squid/access.log.2.gz ]; then
LOG_FILES="-l /var/log/squid/access.log.2.gz"
fi
if [ -s /var/log/squid/access.log.1.gz ]; then
LOG_FILES="-l /var/log/squid/access.log.1.gz"
fi
if [ -s /var/log/squid/access.log ]; then
LOG_FILES="-l /var/log/squid/access.log"
fi

# Get yesterday's date
YESTERDAY=$(date --date "1 days ago" +%d/%m/%Y)

# Get one week ago date
WEEKAGO=$(date --date "7 days ago" +%d/%m/%Y)

exec /usr/bin/sarg \
$LOG_FILES \
-o /var/www/sarg/weekly \
-d $WEEKAGO-$YESTERDAY &>/dev/null
exit 0
And I got this error:

Quote:
[root@proxy ~]# ./sarg1
*** buffer overflow detected ***: /usr/bin/sarg terminated
======= Backtrace: =========
/lib/libc.so.6(__chk_fail+0x41)[0x9a1931]
/lib/libc.so.6[0x9a1058]
/lib/libc.so.6(_IO_default_xsputn+0xcd)[0x92160d]
/lib/libc.so.6(_IO_vfprintf+0xd19)[0x8f88a9]
/lib/libc.so.6(__vsprintf_chk+0xa7)[0x9a1107]
/lib/libc.so.6(__sprintf_chk+0x30)[0x9a1040]
/usr/bin/sarg[0x804ae62]
/usr/bin/sarg[0x806a383]
/usr/bin/sarg[0x8054f17]
/usr/bin/sarg[0x8052096]
/lib/libc.so.6(__libc_start_main+0xdc)[0x8d1e8c]
/usr/bin/sarg[0x8049711]
======= Memory map: ========
00101000-0017e000 r-xp 00000000 68:03 1833685 /usr/lib/libfreetype.so.6.3.10
0017e000-00181000 rw-p 0007d000 68:03 1833685 /usr/lib/libfreetype.so.6.3.10
00183000-001aa000 r-xp 00000000 68:03 1833716 /usr/lib/libfontconfig.so.1.1.0
001aa000-001b2000 rw-p 00027000 68:03 1833716 /usr/lib/libfontconfig.so.1.1.0
001cd000-001df000 r-xp 00000000 68:03 1834477 /usr/lib/libz.so.1.2.3
001df000-001e0000 rw-p 00011000 68:03 1834477 /usr/lib/libz.so.1.2.3
00623000-00648000 r-xp 00000000 68:03 1833937 /usr/lib/libpng12.so.0.10.0
00648000-00649000 rw-p 00024000 68:03 1833937 /usr/lib/libpng12.so.0.10.0
0064b000-0066a000 r-xp 00000000 68:03 1834506 /usr/lib/libgd.so.2.0.0
0066a000-0068a000 rw-p 0001e000 68:03 1834506 /usr/lib/libgd.so.2.0.0
0068a000-0069e000 rw-p 0068a000 00:00 0
006a0000-006b0000 r-xp 00000000 68:03 1834509 /usr/lib/libXpm.so.4.11.0
006b0000-006b1000 rw-p 00010000 68:03 1834509 /usr/lib/libXpm.so.4.11.0
00850000-00871000 r-xp 00000000 68:03 1833997 /usr/lib/libjpeg.so.62.0.0
00871000-00872000 rw-p 00020000 68:03 1833997 /usr/lib/libjpeg.so.62.0.0
0089e000-008b8000 r-xp 00000000 68:01 3069201 /lib/ld-2.5.so
008b8000-008b9000 r--p 00019000 68:01 3069201 /lib/ld-2.5.so
008b9000-008ba000 rw-p 0001a000 68:01 3069201 /lib/ld-2.5.so
008bc000-009fa000 r-xp 00000000 68:01 3068177 /lib/libc-2.5.so
009fa000-009fc000 r--p 0013e000 68:01 3068177 /lib/libc-2.5.so
009fc000-009fd000 rw-p 00140000 68:01 3068177 /lib/libc-2.5.so
009fd000-00a00000 rw-p 009fd000 00:00 0
00a02000-00a04000 r-xp 00000000 68:01 3068184 /lib/libdl-2.5.so
00a04000-00a05000 r--p 00001000 68:01 3068184 /lib/libdl-2.5.so
00a05000-00a06000 rw-p 00002000 68:01 3068184 /lib/libdl-2.5.so
00a21000-00a46000 r-xp 00000000 68:01 3068230 /lib/libm-2.5.so
00a46000-00a47000 r--p 00024000 68:01 3068230 /lib/libm-2.5.so
00a47000-00a48000 rw-p 00025000 68:01 3068230 /lib/libm-2.5.so
00b36000-00b41000 r-xp 00000000 68:01 3068192 /lib/libgcc_s-4.1.2-20080825.so.1
00b41000-00b42000 rw-p 0000a000 68:01 3068192 /lib/libgcc_s-4.1.2-20080825.so.1
00b4a000-00c49000 r-xp 00000000 68:03 1833807 /usr/lib/libX11.so.6.2.0
00c49000-00c4d000 rw-p 000ff000 68:03 1833807 /usr/lib/libX11.so.6.2.0
00c4f000-00c54000 r-xp 00000000 68:03 1833777 /usr/lib/libXdmcp.so.6.0.0
00c54000-00c55000 rw-p 00004000 68:03 1833777 /usr/lib/libXdmcp.so.6.0.0
00c57000-00c59000 r-xp 00000000 68:03 1833918 /usr/lib/libXau.so.6.0.0
00c59000-00c5a000 rw-p 00001000 68:03 1833918 /usr/lib/libXau.so.6.0.0
00c5c000-00c7b000 r-xp 00000000 68:01 3068303 /lib/libexpat.so.0.5.0
00c7b000-00c7d000 rw-p 0001e000 68:01 3068303 /lib/libexpat.so.0.5.0
00c98000-00ca7000 r-xp 00000000 68:01 3068188 /lib/libresolv-2.5.so
00ca7000-00ca8000 r--p 0000e000 68:01 3068188 /lib/libresolv-2.5.so
00ca8000-00ca9000 rw-p 0000f000 68:01 3068188 /lib/libresolv-2.5.so
00ca9000-00cab000 rw-p 00ca9000 00:00 0
08047000-08083000 r-xp 00000000 68:03 4580055 /usr/bin/sarg
08083000-0808f000 rw-p 0003b000 68:03 4580055 /usr/bin/sarg
0808f000-08234000 rw-p 0808f000 00:00 0
09376000-09397000 rw-p 09376000 00:00 0 [heap]
f7f89000-f7f8d000 rw-p f7f89000 00:00 0
f7f90000-f7f91000 rw-p f7f90000 00:00 0
f7f91000-f7f95000 r-xp 00000000 68:01 3068198 /lib/libnss_dns-2.5.so
f7f95000-f7f96000 r--p 00003000 68:01 3068198 /lib/libnss_dns-2.5.so
f7f96000-f7f97000 rw-p 00004000 68:01 3068198 /lib/libnss_dns-2.5.so
f7f97000-f7fa0000 r-xp 00000000 68:01 3068200 /lib/libnss_files-2.5.so
f7fa0000-f7fa1000 r--p 00008000 68:01 3068200 /lib/libnss_files-2.5.so
f7fa1000-f7fa2000 rw-p 00009000 68:01 3068200 /lib/libnss_files-2.5.so
f7fa2000-f7fa5000 rw-p f7fa2000 00:00 0
ffec6000-fffa4000 rw-p 7ffffff21000 00:00 0 [stack]
ffffe000-fffff000 r-xp ffffe000 00:00 0
Aborted
Now it shows that 'buffer overflow detected'. What could be the solution to this?
 
Old 02-11-2012, 02:49 AM   #19
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 852

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
This may be a bug in sarg. Are you using the latest version? It could also be caused by something being wrong with the input data, but in any case crashing as a way of informing the user of invalid input is generally not considered a good programming practice.

How large is your log file? If I were you, I would also look at the sarg.conf file and try to play with the settings a bit.
 
Old 02-12-2012, 09:10 AM   #20
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Original Poster
Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Hi millgates,

Quote:
Are you using the latest version?
The version of sarg I'm using is sarg-2.2.3.1 Jan-02-2007.

Quote:
How large is your log file?
If you're asing about access.log then it keeps on rotating, so size of log file keeps on varying.

And here I'm attaching my sarg.conf file. Please look into the configuration file, the changes I have made if it is correct...
Attached Files
File Type: txt sarg.conf.txt (17.3 KB, 10 views)

Last edited by Satyaveer Arya; 02-12-2012 at 09:12 AM.
 
Old 02-12-2012, 11:50 AM   #21
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Satyaveer Arya View Post
Hi millgates,
The version of sarg I'm using is sarg-2.2.3.1 Jan-02-2007.
So you're using five year old software? The latest version is 2.3.1, and if you read the changelogs on the sarg site, you'd see that it's been patched numerous times, to address crashing. Run the latest version.
Quote:
If you're asing about access.log then it keeps on rotating, so size of log file keeps on varying. And here I'm attaching my sarg.conf file. Please look into the configuration file, the changes I have made if it is correct...
The sarg config isn't getting read, since the program is crashing, so there's not much to look at there. Update your software.
 
Old 02-12-2012, 08:36 PM   #22
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Original Poster
Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Quote:
The sarg config isn't getting read, since the program is crashing, so there's not much to look at there. Update your software.
Thanks TBOne, I got it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Giving output of a command as the input to another whirlpool Programming 5 09-07-2010 03:31 PM
vmstat giving corrupted output Abhishek1986 Linux - Kernel 4 05-22-2010 06:05 PM
Audigy 2 ZS not giving any output khaledaboualfa Ubuntu 1 07-19-2006 05:56 PM
fdisk -l has stopped giving output Bruce Hill Slackware 59 09-06-2004 08:14 AM
df -h is giving weird output chens_83 Linux - General 2 12-09-2002 11:32 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration