plpr

package module
Version: v0.0.0-...-caff8c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2018 License: MIT Imports: 5 Imported by: 0

README

plpr-go

plpr-go is PostgreSQL log parser library.

Install

$ go get -d munisystem/plpr-go

Usage

package main

import (
	"github.com/munisystem/plpr-go"
	"fmt"
)

func main() {
	format := "[%m] %h:%d "
	body := `[2007-09-01 16:44:49.244 ADT] 192.168.2.10:ossecdb LOG:  duration: 4.550 ms  statement: SELECT id FROM location WHERE name = 'enigma->/var/log/messages' AND server_id = '1'`
	logs := plpr.Parse(body, format)
	fmt.Println(logs[0].Query)
	//=> "SELECT id FROM location WHERE name = 'enigma->/var/log/messages' AND server_id = '1'"
}

License

MIT © munisystem

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log struct {
	User     string
	DBName   string
	Host     string
	HostPort string
	Pid      int64
	Time     time.Time
	Duration float64
	Query    string
}

func Parse

func Parse(data, format string) []*Log

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL