Bug 667935 - DS pipe log script's logregex.py plugin is not redirecting the log output to the text file
Summary: DS pipe log script's logregex.py plugin is not redirecting the log output to ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Command Line Utilities
Version: 1.2.8
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Rich Megginson
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks: 639035 389_1.2.8
TreeView+ depends on / blocked
 
Reported: 2011-01-07 11:09 UTC by Sankar Ramalingam
Modified: 2015-12-07 17:06 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-07 17:06:37 UTC


Attachments (Terms of Use)
0001-Bug-667935-DS-pipe-log-script-s-logregex.py-plugin-i.patch (3.28 KB, patch)
2011-02-01 15:09 UTC, Rich Megginson
nkinder: review+
Details | Diff

Description Sankar Ramalingam 2011-01-07 11:09:40 UTC
Description of problem: 

DS pipe log script failed to redirect the output to a text file when the logregex.py plugin is used. The output is getting redirected only after killing the process with "kill $pid" or "Ctrl+C".

Steps to Reproduce:
1. Configure access logs for named pipe. Set these access log attributes using ldapmodify.
    nsslapd-accesslog-maxlogsperdir: 1
    nsslapd-accesslog-logexpirationtime: -1
    nsslapd-accesslog-logrotationtime: -1
    nsslapd-accesslog: /var/log/dirsrv/slapd-$inst_name/access.pipe
    nsslapd-accesslog-logbuffering: off
 
2. Run the ds-logpipe.py script.
    /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-inst/access.pipe --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" > /tmp/test_access &
3. Run ldapsearch to search for unavailable entries. Ldapsearch should return error 32(no such object).
4. Check the "/tmp/test_acces" file for log entries.
  
Actual results:

No errors redirected to the output file.

Expected results:

error messages should be logged into the redirected file.

Additional info:

It redirects the output to a file once the ds-logpipe.py process is killed.

Comment 1 Rich Megginson 2011-02-01 15:09:42 UTC
Created attachment 476412 [details]
0001-Bug-667935-DS-pipe-log-script-s-logregex.py-plugin-i.patch

Comment 2 Rich Megginson 2011-02-01 17:06:31 UTC
To ssh://git.fedorahosted.org/git/389/ds.git
   68d53e3..3c2d82e  master -> master
commit 3c2d82e345522ae0eb349759a96b01e5efe9eff1
Author: Rich Megginson <rmeggins@redhat.com>
Date:   Mon Jan 31 19:08:40 2011 -0700
    Reviewed by: nkinder (Thanks!)
    Branch: master
    Fix Description: The logregex plugin function is really just a thin wrapper
    around the builtin plugin - the only difference is that logregex will only
    store those lines that match the given regexes.  The fix is to just remove
    the post function, and make the plugin just call the main plugin function
    with the line if it matches the regexes.  The only tricky part is that we
    have to increment total lines in the logregex plugin and decrement it when
    we call the main pluginfunction, in order to keep an accurate count of the
    total number of lines read.  I also cleaned up an error message and made
    the print out flush.
    Platforms tested: RHEL6 x86_64
    Flag Day: no
    Doc impact: no

Comment 3 Amita Sharma 2011-05-11 10:48:11 UTC
Steps to Reproduce:
1. Configure access logs for named pipe. Set these access log attributes using
ldapmodify.

ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
dn: cn=config
changetype: modify
replace: nsslapd-accesslog
nsslapd-accesslog: /var/log/dirsrv/slapd-testvm/access.pipe
-
ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
dn: cn=config
changetype: modify
replace: nsslapd-accesslog-logbuffering
nsslapd-accesslog-logbuffering: off
-
ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
dn: cn=config
changetype: modify
replace: nsslapd-accesslog-maxlogsperdir
nsslapd-accesslog-maxlogsperdir: 1
- 
ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
dn: cn=config
changetype: modify
replace: nsslapd-accesslog-logexpirationtime
nsslapd-accesslog-logexpirationtime: -1
- 
ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
dn: cn=config
changetype: modify
replace: nsslapd-accesslog-logrotationtime
nsslapd-accesslog-logrotationtime: -1


2. Run the ds-logpipe.py script.
    /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access.pipe --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" > /tmp/test_access &

3. Run ldapsearch to search for unavailable entries. Ldapsearch should return
error 32(no such object).

[root@testvm yum.repos.d]# ldapsearch -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -b "cn=xyz"
# extended LDIF
#
# LDAPv3
# base <cn=xyz> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

# numResponses: 1
[root@testvm yum.repos.d]# ldapsearch -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -b "cn=hello"
# extended LDIF
#
# LDAPv3
# base <cn=hello> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

# numResponses: 1
[root@testvm yum.repos.d]# ldapsearch -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -b "cn=bye"
# extended LDIF
#
# LDAPv3
# base <cn=bye> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

# numResponses: 1

4. Check the "/tmp/test_acces" file for log entries.

No errors redirected to the output file.

Note : now there is no output even after killing the process and control+c, 
Is it what is expected now after the fix?

Comment 4 Rich Megginson 2011-05-11 13:16:30 UTC
(In reply to comment #3)
> Steps to Reproduce:
> 1. Configure access logs for named pipe. Set these access log attributes using
> ldapmodify.
> 
> ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
> dn: cn=config
> changetype: modify
> replace: nsslapd-accesslog
> nsslapd-accesslog: /var/log/dirsrv/slapd-testvm/access.pipe
> -
> ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
> dn: cn=config
> changetype: modify
> replace: nsslapd-accesslog-logbuffering
> nsslapd-accesslog-logbuffering: off
> -
> ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
> dn: cn=config
> changetype: modify
> replace: nsslapd-accesslog-maxlogsperdir
> nsslapd-accesslog-maxlogsperdir: 1
> - 
> ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
> dn: cn=config
> changetype: modify
> replace: nsslapd-accesslog-logexpirationtime
> nsslapd-accesslog-logexpirationtime: -1
> - 
> ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
> dn: cn=config
> changetype: modify
> replace: nsslapd-accesslog-logrotationtime
> nsslapd-accesslog-logrotationtime: -1

It is better to do all of these modifications as a single ldapmodify command as described here - http://directory.fedoraproject.org/wiki/Named_Pipe_Log_Script#Directory_Server_Log_Configuration

> 
> 
> 2. Run the ds-logpipe.py script.
>     /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access.pipe
> --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" >
> /tmp/test_access &

You have to do this before you modify the server.  When you make this change:
> replace: nsslapd-accesslog
> nsslapd-accesslog: /var/log/dirsrv/slapd-testvm/access.pipe

If access.pipe does not exist, the server will create it as a regular file, not a pipe (unless you have a step 0 mkfifo /var/log/dirsrv/slapd-testvm/access.pipe).

> 
> 3. Run ldapsearch to search for unavailable entries. Ldapsearch should return
> error 32(no such object).
> 
> <snip>
> 
> 4. Check the "/tmp/test_acces" file for log entries.
> 
> No errors redirected to the output file.
> 
> Note : now there is no output even after killing the process and control+c, 
> Is it what is expected now after the fix?

ls -al /var/log/dirsrv/slapd-testvm
ls -al /tmp/test_acces

Comment 5 Amita Sharma 2011-05-12 06:47:59 UTC
Method 1
===========
step 0 mkfifo /var/log/dirsrv/slapd-testvm/access115.pipe

step 1 ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -f namepipeconfig.ldif

namepipeconfig.ldif
======================
dn: cn=config
changetype: modify
replace: nsslapd-accesslog-maxlogsperdir
nsslapd-accesslog-maxlogsperdir: 1
-
replace: nsslapd-accesslog-logexpirationtime
nsslapd-accesslog-logexpirationtime: -1
-
replace: nsslapd-accesslog-logrotationtime
nsslapd-accesslog-logrotationtime: -1
-
replace: nsslapd-accesslog
nsslapd-accesslog: /var/log/dirsrv/slapd-testvm/access115.pipe
-
replace: nsslapd-accesslog-logbuffering
nsslapd-accesslog-logbuffering: off

Getting error here 
********************
modifying entry "cn=config"
ldap_modify: Server is unwilling to perform (53)
	additional info: Cannot open accesslog directory "/var/log/dirsrv/slapd-testvm/access115.pipe", client accesses will not be logged.

[root@testvm amsharma]# ls -l /var/log/dirsrv/slapd-testvm
total 1084
-rw-------. 1 nobody nobody 191445 May 11 12:46 access
prw-------. 1 root   root        0 May 12 11:44 access111.pipe
prw-r--r--. 1 root   root        0 May 12 11:51 access112.pipe
prw-r--r--. 1 root   root        0 May 12 11:59 access115.pipe
prw-------. 1 root   root        0 May 11 13:48 access11.pipe
prw-------. 1 root   root        0 May 11 13:18 access1.pipe


Ok, let us try now the Method 2
=================================
Step 1
Execute - /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access999.pipe --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" > /tmp/test_access &
[1] 11841

Step 2
Make server changes
ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -f namepipeconfig.ldif

Ofcourse, I have changed in namepipeconfig.ldif-
replace: nsslapd-accesslog
nsslapd-accesslog: /var/log/dirsrv/slapd-testvm/access999.pipe

Here Got the error as
************************* 
<<modifying entry "cn=config"
ldap_modify: Server is unwilling to perform (53)
	additional info: Cannot open accesslog directory "/var/log/dirsrv/slapd-testvm/access999.pipe", client accesses will not be logged.

[root@testvm amsharma]# ls -l /var/log/dirsrv/slapd-testvm
total 1084
-rw-------. 1 nobody nobody 191445 May 11 12:46 access
prw-------. 1 root   root        0 May 12 11:44 access111.pipe
prw-r--r--. 1 root   root        0 May 12 11:51 access112.pipe
prw-r--r--. 1 root   root        0 May 12 11:59 access115.pipe
prw-------. 1 root   root        0 May 11 13:48 access11.pipe
prw-------. 1 root   root        0 May 11 13:18 access1.pipe
-rw-------. 1 nobody nobody 121922 May  6 18:37 access.20110506-180733
-rw-------. 1 nobody nobody 682531 May 10 15:37 access.20110509-165423
prw-------. 1 root   root        0 May 12 12:06 access999.pipe

vim /tmp/test_access - empty

# kill -9 11841
>>

Step 3
Run ldapsearch to search for unavailable entries. Ldapsearch should return error 32(no such object).

Step 4
Check the "/tmp/test_acces" file for log entries.
ls -al /var/log/dirsrv/slapd-testvm
ls -al /tmp/test_acces

 Method 3
===============
Step 1 
Make server changes
ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -f namepipeconfig.ldif
modifying entry "cn=config"

Step 2
Execute - /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access555.pipe --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" > /tmp/test_access &
[1] 11861

Step 3
Run ldapsearch to search for unavailable entries. Ldapsearch should return error 32(no such object).

here I got 
*****************
[root@testvm amsharma]# ldapsearch -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -b "cn=hello"
# extended LDIF
#
# LDAPv3
# base <cn=hello> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

# numResponses: 1
[1]+  Exit 1                  /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access555.pipe --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" > /tmp/test_access

Step 4
Check the "/tmp/test_acces" file for log entries.
ls -al /var/log/dirsrv/slapd-testvm
ls -al /tmp/test_acces

[root@testvm amsharma]# ls -al /var/log/dirsrv/slapd-testvm
total 1100
drwxrwx---. 2 nobody nobody   4096 May 12 12:11 .
drwxr-xr-x. 4 root   root     4096 May 10 17:21 ..
-rw-------. 1 nobody nobody 191445 May 11 12:46 access
prw-------. 1 root   root        0 May 12 11:44 access111.pipe
prw-r--r--. 1 root   root        0 May 12 11:51 access112.pipe
prw-r--r--. 1 root   root        0 May 12 11:59 access115.pipe
prw-------. 1 root   root        0 May 11 13:48 access11.pipe
prw-------. 1 root   root        0 May 11 13:18 access1.pipe
-rw-------. 1 nobody nobody 121922 May  6 18:37 access.20110506-180733
-rw-------. 1 nobody nobody 682531 May 10 15:37 access.20110509-165423
-rw-------. 1 nobody nobody   1511 May 12 12:12 access555.pipe
-rw-------. 1 nobody nobody     63 May 12 12:11 access555.pipe.rotationinfo
prw-------. 1 root   root        0 May 12 12:06 access999.pipe

vim /tmp/test_access
Error: /var/log/dirsrv/slapd-testvm/access555.pipe exists and is not a log pipe
use a filename other than /var/log/dirsrv/slapd-testvm/access555.pipe

Method 4
===========
1. Make server changes
ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -f namepipeconfig.ldif

dn: cn=config
changetype: modify
replace: nsslapd-accesslog-maxlogsperdir
nsslapd-accesslog-maxlogsperdir: 1
-
replace: nsslapd-accesslog-logexpirationtime
nsslapd-accesslog-logexpirationtime: -1
-
replace: nsslapd-accesslog-logrotationtime
nsslapd-accesslog-logrotationtime: -1
-
replace: nsslapd-accesslog-logbuffering
nsslapd-accesslog-logbuffering: off

2. Execute - /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access666.pipe --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" > /tmp/test_access &
[1] 11881

3. Now -- 
ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 << EOF
dn: cn=config
changetype: modify
replace: nsslapd-accesslog
nsslapd-accesslog: /var/log/dirsrv/slapd-testvm/access666.pipe

Got the error
===========
modifying entry "cn=config"
ldap_modify: Server is unwilling to perform (53)
	additional info: Cannot open accesslog directory "/var/log/dirsrv/slapd-testvm/access666.pipe", client accesses will not be logged.

4. Run ldapsearch to search for unavailable entries. Ldapsearch should return error 32(no such object).

5. Check the "/tmp/test_acces" file for log entries.
ls -al /var/log/dirsrv/slapd-testvm
prw-------. 1 root   root        0 May 12 12:17 access666.pipe

ls -al /tmp/test_access
-rw-r--r--. 1 root root 0 May 12 12:17 /tmp/test_access
File is still empty

6. kill -9 11881

File is still empty.

I am facing error in any of the case, and the file is still empty.
Please advice.

Comment 6 Rich Megginson 2011-05-12 16:19:28 UTC
Method 2 should work.  I think the problem is permissions.  I'm assuming the server is running as userid "nobody" (according to the ownership of the /var/log/dirsrv/slapd-testvm directory.  Note that you are running the test as root, and the pipe files look like this:
prw-r--r--. 1 root   root        0 May 12 11:51 access112.pipe
etc.  This means the server cannot write to the pipe, hence the UNWILLING_TO_PERFORM error.  The log pipe script has a flag just for this purpose: -u userid.  So try it like this:

1) /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access999.pipe -u nobody
--plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" >
/tmp/test_access &
2) ldapmodify .....

Comment 7 Amita Sharma 2011-05-13 06:11:04 UTC
yeah, correct.....

Step 1
Execute - /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -u nobody --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" > /tmp/test_access &


Step 2
Make server changes
ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -f namepipeconfig.ldif


Step 3
Run ldapsearch to search for unavailable entries. Ldapsearch should return
error 32(no such object).

Step 4
Check the "/tmp/test_acces" file for log entries.
ls -al /var/log/dirsrv/slapd-testvm -rw-------. 1 nobody nobody     63 May 13 11:35 access123.pipe.rotationinfo
ls -al /tmp/test_access -rw-r--r--. 1 root root 0 May 13 11:34 /tmp/test_access

But the original problem is still intact...
/tmp/test_access is empty and even after killing the process of name pipe, nothing logged into the file..
Is it also related to some permissions??
Okie, I tried after
ls -al /tmp/test_access
rwxrwxrwx. 1 root root 0 May 13 11:43 /tmp/test_access

But still :(

Please advice..

Comment 8 Rich Megginson 2011-05-13 20:35:43 UTC
(In reply to comment #7)
> yeah, correct.....
> 
> Step 1
> Execute - /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -u
> nobody --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" >
> /tmp/test_access &

Try adding the -d option - let's see if there are any errors running the log pipe script

/usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -d -u nobody --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" > /tmp/test_access &
> 
> 
> Step 2
> Make server changes
> ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -f
> namepipeconfig.ldif

Any errors this time?
 
> 
> Step 3
> Run ldapsearch to search for unavailable entries. Ldapsearch should return
> error 32(no such object).
> 
> Step 4
> Check the "/tmp/test_acces" file for log entries.
> ls -al /var/log/dirsrv/slapd-testvm -rw-------. 1 nobody nobody     63 May 13
> 11:35 access123.pipe.rotationinfo
> ls -al /tmp/test_access -rw-r--r--. 1 root root 0 May 13 11:34 /tmp/test_access
> 
> But the original problem is still intact...
> /tmp/test_access is empty and even after killing the process of name pipe,
> nothing logged into the file..
> Is it also related to some permissions??

I don't think so.

Let's see if the -d flag tells us anything

Comment 9 Amita Sharma 2011-05-16 09:20:42 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > yeah, correct.....
> > 
> > Step 1
> > Execute - /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -u
> > nobody --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" >
> > /tmp/test_access &
> 
> Try adding the -d option - let's see if there are any errors running the log
> pipe script
> 
> /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -d -u nobody
> --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" >
> /tmp/test_access &
> > 
okie, tried.
> > 
> > Step 2
> > Make server changes
> > ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -f
> > namepipeconfig.ldif
> 
> Any errors this time?
> 
no till now.
> > 
> > Step 3
> > Run ldapsearch to search for unavailable entries. Ldapsearch should return
> > error 32(no such object).
> > 
> > Step 4
> > Check the "/tmp/test_acces" file for log entries.
> > ls -al /var/log/dirsrv/slapd-testvm -rw-------. 1 nobody nobody     63 May 13
> > 11:35 access123.pipe.rotationinfo
> > ls -al /tmp/test_access -rw-r--r--. 1 root root 0 May 13 11:34 /tmp/test_access
> > 
> > But the original problem is still intact...
> > /tmp/test_access is empty and even after killing the process of name pipe,
> > nothing logged into the file..
> > Is it also related to some permissions??
> 
> I don't think so.
> 
> Let's see if the -d flag tells us anything
Still getting no contents in the text file>
If I do kill -9 pid then again no contents.
If I do kill pid then --
contents of /tmp/test_access
==============================
Creating log pipe /var/log/dirsrv/slapd-testvm/access606.pipe
Listening to log pipe /var/log/dirsrv/slapd-testvm/access606.pipe number of lines 1000
Read 0 total lines
/var/log/dirsrv/slapd-testvm/access606.pipe ============================================================
~

Comment 10 Rich Megginson 2011-05-16 17:26:11 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > yeah, correct.....
> > > 
> > > Step 1
> > > Execute - /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -u
> > > nobody --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" >
> > > /tmp/test_access &
> > 
> > Try adding the -d option - let's see if there are any errors running the log
> > pipe script
> > 
> > /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -d -u nobody
> > --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32" >
> > /tmp/test_access &
> > > 
> okie, tried.
> > > 
> > > Step 2
> > > Make server changes
> > > ldapmodify -x -h localhost -p 389 -D "cn=Directory Manager" -w Secret123 -f
> > > namepipeconfig.ldif
> > 
> > Any errors this time?
> > 
> no till now.
> > > 
> > > Step 3
> > > Run ldapsearch to search for unavailable entries. Ldapsearch should return
> > > error 32(no such object).
> > > 
> > > Step 4
> > > Check the "/tmp/test_acces" file for log entries.
> > > ls -al /var/log/dirsrv/slapd-testvm -rw-------. 1 nobody nobody     63 May 13
> > > 11:35 access123.pipe.rotationinfo
> > > ls -al /tmp/test_access -rw-r--r--. 1 root root 0 May 13 11:34 /tmp/test_access
> > > 
> > > But the original problem is still intact...
> > > /tmp/test_access is empty and even after killing the process of name pipe,
> > > nothing logged into the file..
> > > Is it also related to some permissions??
> > 
> > I don't think so.
> > 
> > Let's see if the -d flag tells us anything
> Still getting no contents in the text file>
> If I do kill -9 pid then again no contents.
> If I do kill pid then --
> contents of /tmp/test_access
> ==============================
> Creating log pipe /var/log/dirsrv/slapd-testvm/access606.pipe
> Listening to log pipe /var/log/dirsrv/slapd-testvm/access606.pipe number of
> lines 1000
> Read 0 total lines
> /var/log/dirsrv/slapd-testvm/access606.pipe
> ============================================================
> ~

Ok, try this - open two windows - in the first window, run
/usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -d -u nobody

in the second window, use ldapmodify to make the directory server log to /var/log/dirsrv/slapd-testvm/access123.pipe, then use ldapsearch to send search requests to the directory server - after several ldapsearch requests, do Ctrl-C in the first window to stop the log pipe - do you see any output?

If that is working, set up everything again, use two windows again - in the first window run

/usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -d -u nobody --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32"

in the second window run the ldapmodify to tell directory server to use the log pipe, then run ldapsearch to search for unavailable entries (e.g. ldapsearch -x ... -s base -b "cn=notfound"

after several ldapsearch requests, do Ctrl-C in the first window to stop the log pipe - do you see any output?

Comment 11 Amita Sharma 2011-05-17 13:56:02 UTC
Ok, try this - open two windows - in the first window, run
/usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -d -u nobody

in the second window, use ldapmodify to make the directory server log to
/var/log/dirsrv/slapd-testvm/access123.pipe, then use ldapsearch to send search
requests to the directory server - after several ldapsearch requests, do Ctrl-C
in the first window to stop the log pipe - do you see any output?


<Amita>

[root@testvm ~]# /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access0.pipe -d -u nobody
Creating log pipe /var/log/dirsrv/slapd-testvm/access0.pipe
Listening to log pipe /var/log/dirsrv/slapd-testvm/access0.pipe number of lines 1000
^C
<After Control + c>
Read 0 total lines
/var/log/dirsrv/slapd-testvm/access0.pipe ============================================================
[root@testvm ~]# 

</Amita>




If that is working, set up everything again, use two windows again - in the
first window run

/usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access909.pipe -d -u nobody
--plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32"

in the second window run the ldapmodify to tell directory server to use the log
pipe, then run ldapsearch to search for unavailable entries (e.g. ldapsearch -x
... -s base -b "cn=notfound"

after several ldapsearch requests, do Ctrl-C in the first window to stop the
log pipe - do you see any output?

<Amita>
After control + c

[root@testvm ~]# /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access9000.pipe -d -u nobody --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32"
Creating log pipe /var/log/dirsrv/slapd-testvm/access9000.pipe
Listening to log pipe /var/log/dirsrv/slapd-testvm/access9000.pipe number of lines 1000
^CRead 0 total lines
/var/log/dirsrv/slapd-testvm/access9000.pipe ============================================================
[root@testvm ~]# ls -l /var/log/dirsrv/slapd-testvm/
total 192
prw-------. 1 nobody root        0 May 17 18:28 access0.pipe
-rw-------. 1 nobody nobody 172896 May 17 19:23 access123.pipe
-rw-------. 1 nobody nobody     63 May 16 15:28 access123.pipe.rotationinfo
prw-------. 1 nobody root        0 May 17 19:22 access9000.pipe
prw-------. 1 nobody root        0 May 17 19:18 access909.pipe
-rw-------. 1 nobody nobody      0 May 16 15:28 audit
-rw-------. 1 nobody nobody     63 May 16 15:28 audit.rotationinfo
-rw-------. 1 nobody nobody   3715 May 17 16:47 errors
-rw-------. 1 nobody nobody     63 May 16 15:28 errors.rotationinfo

Comment 12 Rich Megginson 2011-05-17 17:23:50 UTC
(In reply to comment #11)
> Ok, try this - open two windows - in the first window, run
> /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access123.pipe -d -u nobody
> 
> in the second window, use ldapmodify to make the directory server log to
> /var/log/dirsrv/slapd-testvm/access123.pipe, then use ldapsearch to send search
> requests to the directory server - after several ldapsearch requests, do Ctrl-C
> in the first window to stop the log pipe - do you see any output?
> 
> 
> <Amita>
> 
> [root@testvm ~]# /usr/bin/ds-logpipe.py
> /var/log/dirsrv/slapd-testvm/access0.pipe -d -u nobody
> Creating log pipe /var/log/dirsrv/slapd-testvm/access0.pipe
> Listening to log pipe /var/log/dirsrv/slapd-testvm/access0.pipe number of lines
> 1000
> ^C
> <After Control + c>
> Read 0 total lines
> /var/log/dirsrv/slapd-testvm/access0.pipe
> ============================================================
> [root@testvm ~]# 

The directory server is not opening the write end of the pipe.  In fact, you should see several closes and reopens of the pipe when you do the ldapmodify on the directory server to tell it to use /var/log/dirsrv/slapd-testvm/access0.pipe.  After you run ds-logpipe.py, you did the ldapmodify?  If so, can you post the file you passed to ldapmodify to tell it to log to /var/log/dirsrv/slapd-testvm/access0.pipe?

> 
> </Amita>
> 
> 
> 
> 
> If that is working, set up everything again, use two windows again - in the
> first window run
> 
> /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-testvm/access909.pipe -d -u nobody
> --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32"
> 
> in the second window run the ldapmodify to tell directory server to use the log
> pipe, then run ldapsearch to search for unavailable entries (e.g. ldapsearch -x
> ... -s base -b "cn=notfound"
> 
> after several ldapsearch requests, do Ctrl-C in the first window to stop the
> log pipe - do you see any output?
> 
> <Amita>
> After control + c
> 
> [root@testvm ~]# /usr/bin/ds-logpipe.py
> /var/log/dirsrv/slapd-testvm/access9000.pipe -d -u nobody
> --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=32"
> Creating log pipe /var/log/dirsrv/slapd-testvm/access9000.pipe
> Listening to log pipe /var/log/dirsrv/slapd-testvm/access9000.pipe number of
> lines 1000
> ^CRead 0 total lines
> /var/log/dirsrv/slapd-testvm/access9000.pipe
> ============================================================

This isn't going to work until we can confirm that the directory server is actually writing to the log pipe.

> [root@testvm ~]# ls -l /var/log/dirsrv/slapd-testvm/
> total 192
> prw-------. 1 nobody root        0 May 17 18:28 access0.pipe
> -rw-------. 1 nobody nobody 172896 May 17 19:23 access123.pipe
> -rw-------. 1 nobody nobody     63 May 16 15:28 access123.pipe.rotationinfo
> prw-------. 1 nobody root        0 May 17 19:22 access9000.pipe
> prw-------. 1 nobody root        0 May 17 19:18 access909.pipe
> -rw-------. 1 nobody nobody      0 May 16 15:28 audit
> -rw-------. 1 nobody nobody     63 May 16 15:28 audit.rotationinfo
> -rw-------. 1 nobody nobody   3715 May 17 16:47 errors
> -rw-------. 1 nobody nobody     63 May 16 15:28 errors.rotationinfo

Comment 13 Sankar Ramalingam 2011-06-15 13:36:05 UTC
I still see the same old problem. The pipe log output is not getting redirected to the text file, until the ds-logpipe.py script is killed(ctl+c).
1). Configure named pipe for access log. 
Run ds-logpipe.py script at terminal 1:
        /usr/bin/ds-logpipe.py /var/log/dirsrv/slapd-inferno/access -t 60 --plugin=/usr/share/dirsrv/data/logregex.py logregex.regex="err=" > /tmp/test_new
2). Restart the dirsrv services.
3). From terminal 2, run multiple ldapsearch to get err=32 and err=49.
4). From termial 3, run cat < /tmp/test_new
      Result: No contents
5). Kill the ds-logpipe.py script at terminal 1 and cat the file from terminal 3.
      Result: Able to see the "err=*" lines printed.
[15/Jun/2011:15:47:56 -0400] conn=12 op=0 RESULT err=0 tag=97 nentries=0 etime=0 dn="cn=directory manager"
[15/Jun/2011:15:47:56 -0400] conn=12 op=1 RESULT err=32 tag=101 nentries=0 etime=0
[15/Jun/2011:15:47:57 -0400] conn=13 op=0 RESULT err=0 tag=97 nentries=0 etime=0 dn="cn=directory manager"
[15/Jun/2011:15:47:57 -0400] conn=13 op=1 RESULT err=32 tag=101 nentries=0 etime=0
[15/Jun/2011:15:47:57 -0400] conn=14 op=0 RESULT err=0 tag=97 nentries=0 etime=0 dn="cn=directory manager"

Comment 14 Rich Megginson 2011-06-15 17:33:53 UTC
(In reply to comment #13)
> I still see the same old problem. The pipe log output is not getting redirected
> to the text file, until the ds-logpipe.py script is killed(ctl+c).

This is working as designed.  When using ds-logpipe.py with no plugin, or using the logregex plugin, all of the server output is buffered inside the script, and is only printed upon exit or kill -1.

Note that this is different than the behavior of the failedbinds.py plugin, which _does write_ to the given log file as the events happen.

Comment 15 Amita Sharma 2011-07-18 07:35:21 UTC
Based On Comment 14, marking as VERIFIED.


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