Parse openldap log, and output json format
Go to file
2022-07-21 19:03:24 +02:00
openldap-log-parser first commit 2022-07-21 19:03:24 +02:00
test first commit 2022-07-21 19:03:24 +02:00
.gitignore first commit 2022-07-21 19:03:24 +02:00
go.mod first commit 2022-07-21 19:03:24 +02:00
go.sum first commit 2022-07-21 19:03:24 +02:00
LICENSE first commit 2022-07-21 19:03:24 +02:00
openldap-log-parser.go first commit 2022-07-21 19:03:24 +02:00
README.md first commit 2022-07-21 19:03:24 +02:00

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.

# cat /var/log/slapd.log | ./openldap-log-parser | jq

Use -f flag to flatten json structure:

# 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" :

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")