A lightweight C-based Linux CLI tool to rescue your systemd logs before they rescue you.
OPS is a fast, secure, and minimal Linux CLI utility written in C, designed for system administrators who just want their journalctl logs β quickly, safely, and without drama.
Whether you want to view logs directly in the terminal or save them to a file for later analysis, OPS has your back.
Because sometimes the system breaks⦠and you just whisper: Oh please, save-me.
- β‘ Written in C
- High performance with near-zero overhead
- π Live View
- Display logs for any systemd service directly in your terminal
- πΎ Export Mode
- Save logs to a local file using the
-sflag
- Save logs to a local file using the
- π Hardened Security
- Strict validation: service names must be alphanumeric (including
.,-,_) - Safe bounds: service names limited to 128 characters to prevent buffer overflows
- Strict validation: service names must be alphanumeric (including
- π§΅ Robust Process Handling
- Uses
fork()andexecvp()instead of unsafesystem()calls
- Uses
- π Global Access
- Installs to
/usr/local/binfor system-wide availability
- Installs to
Install OPS globally with a single command:
curl -fsSL https://raw.githubusercontent.com/49mg/ops/main/install.sh | bashThis will automatically clone, compile, and install the ops binary.
ops nginxDisplays logs for the nginx systemd service.
ops nginx -sLogs will be saved in your current directory as:
nginx.log
With permissions set to 0644.
OPS implements multiple layers of protection:
-
Input Sanitization
- Rejects any input containing
/,\, or shell redirection characters
- Rejects any input containing
-
Privilege Separation
- Uses
fork()to isolatejournalctlexecution
- Uses
-
Standard File Permissions
- Owner: Read / Write
- Group & Others: Read-only
-
No External Dependencies
- Relies only on standard C libraries and
systemd
- Relies only on standard C libraries and
ops/
βββ main.c # Argument parsing with getopt
βββ utils.c # Security validation & process logic
βββ utils.h # Function prototypes
βββ Makefile # Automated build system
βββ install.sh # Automated remote installer
βββ README.md # Documentation
-
Linux system with:
systemd(journalctl)gccmake
This project is licensed under the MIT License.
Built for sysadmins whoβve said βoh pleaseβ¦β one too many times. π