update audit

This commit is contained in:
Lifailon
2026-03-14 12:58:18 +03:00
parent a93d3d69b2
commit 2bc00dfcd9
2 changed files with 27 additions and 25 deletions
+18 -18
View File
@@ -1,23 +1,23 @@
system:
date: 04.02.2026 12:50:24
go: 1.25.6
date: 14.03.2026 12:47:21
go: 1.24.0
os: linux Ubuntu 25.04 (Plucky Puffin)
arch: amd64
username: lifailon
privilege: user
execType: source code
execPath: /tmp/go-build3916067317/b001/exe/main
execPath: /tmp/go-build3685129505/b001/exe/main
journald:
- installed: true
journals:
- name: Unit service list
count: 229
- name: System units
count: 232
- name: User units
count: 101
- name: System journals
count: 94223
- name: User journals
count: 154
count: 85
- name: Kernel boot
count: 42
count: 32
auditd:
- installed: true
version: 1:4.0.2
@@ -25,28 +25,28 @@ auditd:
fileSystem:
- name: System var logs
path: /var/log/
count: 293
count: 259
- name: Custom path
path: /opt/
count: 2
- name: Users home logs
path: /home/
count: 202
count: 223
- name: Process descriptor logs
path: descriptor
count: 78
count: 38
containerizationSystem:
- name: docker
installed: true
version: 27.5.1
containers: 24
version: 28.2.2
containers: 29
context:
current: default
count: 4
count: 1
- name: compose
installed: true
version: 2.39.2
stacks: 8
version: 2.26.1
stacks: 9
- name: podman
installed: true
version: 5.7.1
@@ -54,7 +54,7 @@ containerizationSystem:
- name: kubernetes
installed: true
version: 1.34.3
pods: 93
pods: 94
context:
current: default
count: 1
+9 -7
View File
@@ -365,7 +365,7 @@ func showHelp() {
fmt.Println(" --mouse-disable, -m " + mouseDisableDescription)
fmt.Println(" --wrap-disable, -w " + wrapDisableDescription)
fmt.Println(" --color-mode, -C " + colorModeDescription)
fmt.Println(" --unit-type, -U " + unitTypeDescription)
fmt.Println(" --unit-types, -U " + unitTypeDescription)
fmt.Println(" --journal-field, -j " + journalFieldDescription)
fmt.Println(" --journal-priority, -J " + journalPriorityDescription)
fmt.Println(" --journal-boot, -b " + journalBootDescription)
@@ -617,6 +617,11 @@ func (app *App) showAudit() {
auditText = append(auditText,
"journald:",
)
// default values
app.unitType = "service"
app.journalField = "SYSLOG_IDENTIFIER"
app.journalPriority = "debug"
app.journalBoot = "all"
csCheck := exec.Command("journalctl", "--version")
_, err := csCheck.Output()
if err == nil {
@@ -984,9 +989,6 @@ func (app *App) journalCheck(mode string) ([]string, error) {
cmd = exec.Command(
cli, "--no-pager", flag)
}
if app.logging {
slog.Info(cmd.String(), "action", "Check the flag")
}
output, err := cmd.Output()
if err != nil {
return nil, fmt.Errorf("%s", string(output))
@@ -1120,7 +1122,7 @@ func runGoCui(mock bool) {
colorModeFlag := flag.String("color-mode", "default", colorModeDescription)
flag.StringVar(colorModeFlag, "C", "default", colorModeDescription)
// Специфические настройки
unitTypeFlag := flag.String("unit-type", "service", unitTypeDescription)
unitTypeFlag := flag.String("unit-types", "service", unitTypeDescription)
flag.StringVar(unitTypeFlag, "U", "service", unitTypeDescription)
journalFieldFlag := flag.String("journal-field", "SYSLOG_IDENTIFIER", journalFieldDescription)
flag.StringVar(journalFieldFlag, "j", "SYSLOG_IDENTIFIER", journalFieldDescription)
@@ -1357,14 +1359,14 @@ func runGoCui(mock bool) {
}
}
// -U/--unit-type
// -U/--unit-types
if config.Settings.UnitType != "" && *unitTypeFlag == "service" {
app.unitType = config.Settings.UnitType
} else {
app.unitType = *unitTypeFlag
}
// Проверяем значение флага -U/--unit-type на валидность и возвращяем список всех существующих типов юнитов
// Проверяем значение флага -U/--unit-types на валидность и возвращяем список всех существующих типов юнитов
if app.unitType != "service" {
unitTypesList, unitTypesErr := app.journalCheck("units")
if unitTypesErr == nil {