first commit

This commit is contained in:
yo
2022-07-21 19:03:24 +02:00
commit 187b76e95d
15 changed files with 2795 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
# openldap-log-parser
Parse openldap log, and output json format
At the moment, openldap-log-parser focus on these log levels:
- 256 (stats log connections/operations/results)
## Install
Copy `openldap-log-parser` into your PATH and set executable flag.
## Usage
Input openldap logs as os stdin.
``` console
# cat /var/log/slapd.log | ./openldap-log-parser | jq
```
Use -f flag to flatten json structure:
``` console
# cat /var/log/slapd.log | ./openldap-log-parser -f | jq
```
Use "-o filename.json" to write output to file.
## Piping rsyslog to openldap-log-parser
You can feed syslog to openldap-log-parser by using "omprog" rsyslog module, with template "RSYSLOG_FileFormat" :
``` console
module(load="omprog")
[...]
if $programname == "slapd" then
action(
type="omprog"
binary="/usr/local/bin/openldap-log-parser -f -o /var/log/slapd.log.json"
template="RSYSLOG_FileFormat")
```