Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log parser release | first version #4

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@ jobs:
name: Analyze
runs-on: ubuntu-latest

permissions:
actions: read
contents: read
security-events: write
statuses: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/golangci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
name: golangci-lint
name: Go Lint
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
jobs:
golangci:
name: lint
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.19
- uses: actions/checkout@v3
go-version: 1.21.1
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.49.0
only-new-issues: true
version: latest
only-new-issues: true

23 changes: 23 additions & 0 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Golang Vulnerability Check
on:
push:
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
jobs:
golangci:
name: Golang Vulnerability Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21.8
cache: true
- id: govulncheck
uses: golang/govulncheck-action@v1
with:
go-package: ./...

73 changes: 73 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: integration

on:
pull_request:
workflow_dispatch:

permissions:
contents: write

jobs:
integration:
runs-on: ubuntu-latest
strategy:
matrix:
log_prefix:
- "%t [%p]: [%l-1] [trx_id=%x] user=%u,db=%d %r"
- "%t [%p]:"
- '%t %h %u %m '
- '%m (%h:%u) '
- '%m from %h by %u '
- '%m in %d by %u@%h '
- '%t %h %u [%p] '
- '%m (%h:%u:%p) '
- '%m from %h by %u pid=%p '
- '%m in %d by %u@%h pid=%p '
- '%t %h %u db=%d %m '
- '%m in %d by %u@%h'
- '[%p]: %t - %q[db=%d, user=%u, app=%a] - [host=%h, trx_id=%x]'
- '[%p]: %m [%l-1] user=%u, db=%d, app=%a, client=%h'
- 'time=%t, pid=%p %q db=%d, usr=%u, client=%h , app=%a, line=%l'
- '%t [%u@%r/%a/%d:%p]: [%l]'
- '[%p]: %m [%l] (user=%u, db=%d) %h:%r'
- '%m [%p][%v] : [%l-1] %q[app=%a] '
- '%t [%p-%l] %q%u@%d '
- '%m [%p] %q[user=%u,db=%d,app=%a] '
- '%m [%p] %q[user=%u,db=%d,app=%a,host=%h] '
- '%t [%p]: [%l-1] user=%u,db=%d - PG-%e '
- '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h '
- '%t [%p]: [%l-1] [trx_id=%x] user=%u,db=%d '
- '[%p]: [%l-1] db=%d,user=%u '
- '%m %r %u %a [%c] [%p] '
- '%m [%p]: [%l-1] db=%d,user=%u '
- 'pid=%p,user=%u,db=%d,app=%a,client=%h '
- 'user=%u,db=%d,app=%a,client=%h '
- '%p-%s-%c-%l-%h-%u-%d-%m '
- '%m [%p][%b][%v][%x] %q[user=%u,db=%d,app=%a] '
- '%m [%p] %q%u@%d '
- '%t [%p] %q%u@%d %h '
- '%m [%p] '

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-go@v4
with:
go-version: 1.21.1
cache: true

- name: make install
run: make install

- name: create directory for log file
run: mkdir -p docker_testing/pglog/log0 && chmod -R 777 docker_testing/pglog && chmod -R 777 docker_testing/pglog/log0

- name: Setup and run test
run: |
cd docker_testing
integrationtest setup --prefix "${{ matrix.log_prefix }}"
sudo chmod -R 777 pglog/log0
integrationtest test -p "${{ matrix.log_prefix }}" -f "pglog/log0/postgresql*.log"
docker-compose down -v
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: artifcats
name: Go Build

on:
push:
tags:
- "*"
- "v*"

permissions:
contents: write
Expand All @@ -14,17 +14,17 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Fetch all tags
run: git fetch --force --tags
-
name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: '>=1.19.0'
go-version: 1.21.1
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@ dist
config.toml
/ciscollector
# End of https://www.toptal.com/developers/gitignore/api/go
.DS_Store
.DS_Store
/kshieldconfig.toml
/cmd/ciscollector/kshieldconfig.toml
.vscode
report.html
report.json

docker_testing/pglog/*
10 changes: 3 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,13 @@ linters:
- misspell
- gofmt
- staticcheck
- gosec
- gocritic
# - gosec
# - gocritic
- vet
# - revive
- deadcode
- errcheck
- gosimple
- govet
- structcheck
- typecheck
- varcheck
# Extras
- gofmt
- goimports
- unused
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ build:
run:
go build -o ./ciscollector ./cmd/ciscollector && ./ciscollector -r
linux:
GOOS=linux GOARCH=amd64 go build -o ./linux/ciscollector ./cmd/ciscollector
GOOS=linux GOARCH=amd64 go build -o ./linux/ciscollector ./cmd/ciscollector

install:
go install ./cmd/ciscollector
go install ./docker_testing/integrationtest
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

[![GitHub Release][release-img]][release]
[![Go Report Card][report-card-img]][report-card]

<!-- [![Build Status](https://github.com/klouddb/klouddbshield/workflows/Build/badge.svg?branch=main)](https://github.com/klouddb/klouddbshield/actions) -->
[![Go Reference](https://pkg.go.dev/badge/github.com/klouddb/klouddbshield.svg)](https://pkg.go.dev/github.com/klouddb/klouddbshield)
[![Go Build](https://github.com/klouddb/klouddbshield/actions/workflows/release.yml/badge.svg)](https://github.com/klouddb/klouddbshield/actions/workflows/release.yml)
[![Go Vuln Check](https://github.com/klouddb/klouddbshield/actions/workflows/govulncheck.yml/badge.svg)](https://github.com/klouddb/klouddbshield/actions/workflows/govulncheck.yml)

[release-img]: https://img.shields.io/github/release/klouddb/klouddbshield.svg?logo=github
[release]: https://github.com/klouddb/klouddbshield/releases
Expand Down
Loading
Loading