Bug 838656 - logconv.pl tool removes the access logs contents if "-M" is not correctly used
logconv.pl tool removes the access logs contents if "-M" is not correctly used
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base (Show other bugs)
7.0
All Linux
medium Severity high
: rc
: 7.0
Assigned To: Rich Megginson
Sankar Ramalingam
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-09 13:38 EDT by Sankar Ramalingam
Modified: 2014-06-17 22:54 EDT (History)
4 users (show)

See Also:
Fixed In Version: 389-ds-base-1.3.1.6-18.el7
Doc Type: Bug Fix
Doc Text:
Cause: Using options -M or -m require a output file arguement. If the output file is not specified, then the script thinks the access log arguement is the output file. Consequence: The access log is overwritten with the output of the -M/-m feature Fix: Properly check all the agruments passed to the script. Result: If a output file is not specified then an error is reported, and the access log is not overwritten.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 08:29:41 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sankar Ramalingam 2012-07-09 13:38:44 EDT
Description of problem: 
     Running logconv.pl tool with -m or -M option without specifying the stats.out file, leads to removal of the access logs file contents. This option is recently introduced to generate Minute/Second based statitics for the ldap operations.

Version-Release number of selected component (if applicable): 389-ds-base-1.2.10.2-20

How reproducible: Consistently

Steps to Reproduce:
1. Install 389-ds-base latest packages on rhel6.
2. Run logconv.pl tool with -M option. 
First, run "ls -l /var/log/dirsrv/slapd-inst/access" to check the size of the file. 
/usr/bin/logconv.pl -M /var/log/dirsrv/slapd-inst/access > /tmp/logconv.out

It generates output as - Illegal division by zero at /usr/bin/logconv.pl line 517

Also, it removes the contents of access logs. Check the file size now.

Actual results: Improper usages of command leads to removal of file contents.

Expected results: Improper usage should give an error message and it should print the help.

Additional info: Correct usage of the command. 
logcov.pl -M /tmp/min_stats.out /var/log/dirsrv/slapd-inst/access
Comment 2 Nathan Kinder 2012-09-20 15:39:22 EDT
Upstream ticket:
https://fedorahosted.org/389/ticket/471
Comment 6 Rich Megginson 2013-10-01 19:26:20 EDT
moving all ON_QA bugs to MODIFIED in order to add them to the errata (can't add bugs in the ON_QA state to an errata).  When the errata is created, the bugs should be automatically moved back to ON_QA.
Comment 8 Sankar Ramalingam 2014-01-30 01:28:56 EST
[root@hp-dl380pgen8-02-vm-1 ~]# ls -l /var/log/dirsrv/slapd-hp-dl380pgen8-02-vm-1/access
-rw-------. 1 svrbld svrbld 60614 Jan 28 07:26 /var/log/dirsrv/slapd-hp-dl380pgen8-02-vm-1/access

[root@hp-dl380pgen8-02-vm-1 ~]# logconv.pl -M /var/log/dirsrv/slapd-hp-dl380pgen8-02-vm-1/access
Access Log Analyzer 8.0

Command: logconv.pl /tmp/testlog

Processing 1 Access Log(s)...

Use of uninitialized value $cursize in sprintf at /usr/bin/logconv.pl line 418.
[00] /tmp/testlog                  	size (bytes):             
Can not open /tmp/testlog error (No such file or directory) at /usr/bin/logconv.pl line 2400.
Cleaning up temp files . . .
Done

[root@hp-dl380pgen8-02-vm-1 ~]# ls -l /var/log/dirsrv/slapd-hp-dl380pgen8-02-vm-1/access
-rw-------. 1 svrbld svrbld 0 Jan 30 01:05 /var/log/dirsrv/slapd-hp-dl380pgen8-02-vm-1/access


Incorrect usage of logconv.pl tool still cleans up the access log files.
Comment 9 Rich Megginson 2014-01-30 10:51:39 EST
I reopened the upstream ticket - see the ticket for comments.
Comment 10 Rich Megginson 2014-01-31 19:34:42 EST
To ssh://git.app.eng.bos.redhat.com/srv/git/389-ds-base.git
   9b1e2d0..7dc5c28  rhel-7.0 -> rhel-7.0
commit 7dc5c28a3beeeb90cdae084ae6d1fa338c09c50f
Author: Rich Megginson <rmeggins@redhat.com>
Date:   Fri Jan 31 16:49:58 2014 -0700
Comment 11 Sankar Ramalingam 2014-02-04 15:51:42 EST
Test1:
[root@hp-dl380pgen8-02-vm-1 ~]# ls -l /var/log/dirsrv/slapd-sriram3/access ; logconv.pl  -M /tmp/test123  
-rw-------. 1 svrbld svrbld 742 Feb  4 15:42 /var/log/dirsrv/slapd-sriram3/access
Usage error for option -m or -M, either the output file or access log is missing!

Cleaning up temp files . . .
Done
[root@hp-dl380pgen8-02-vm-1 ~]# ls -l /var/log/dirsrv/slapd-sriram3/access 
-rw-------. 1 svrbld svrbld 742 Feb  4 15:42 /var/log/dirsrv/slapd-sriram3/access

Test2:
[root@hp-dl380pgen8-02-vm-1 ~]# ls -l /var/log/dirsrv/slapd-sriram3/access ; logconv.pl  -M /var/log/dirsrv/slapd-sriram3/access
-rw-------. 1 svrbld svrbld 742 Feb  4 15:42 /var/log/dirsrv/slapd-sriram3/access
Usage error for option -m or -M, either the output file or access log is missing!

Cleaning up temp files . . .
Done
[root@hp-dl380pgen8-02-vm-1 ~]# ls -l /var/log/dirsrv/slapd-sriram3/access 
-rw-------. 1 svrbld svrbld 742 Feb  4 15:42 /var/log/dirsrv/slapd-sriram3/access


Test1 and Test2 are giving usage error for option -M. Also, -M option doesn't cleanup the access log file contents. Hence, marking the bug as verified.

Build tested - 389-ds-base-1.3.1.6-18
Comment 12 Sankar Ramalingam 2014-02-13 06:51:58 EST
Test cases automated in ./logfile/logconv.sh
Comment 13 Ludek Smid 2014-06-13 08:29:41 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Note You need to log in before you can comment on or make changes to this bug.