Skip to content
/ ops Public

OPS (Oh Please, Save-me) β€” A secure C utility to quickly fetch, filter, and save systemd service logs. Because when things break, you need your logs fast

License

Notifications You must be signed in to change notification settings

49mg/ops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

πŸ†˜ OPS β€” Oh Please, Save-me

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.


✨ Features

  • ⚑ 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 -s flag
  • πŸ” Hardened Security
    • Strict validation: service names must be alphanumeric (including ., -, _)
    • Safe bounds: service names limited to 128 characters to prevent buffer overflows
  • 🧡 Robust Process Handling
    • Uses fork() and execvp() instead of unsafe system() calls
  • 🌍 Global Access
    • Installs to /usr/local/bin for system-wide availability

πŸš€ One-Liner Installation

Install OPS globally with a single command:

curl -fsSL https://raw.githubusercontent.com/49mg/ops/main/install.sh | bash

This will automatically clone, compile, and install the ops binary.


πŸ§ͺ Usage

πŸ“Ÿ View Logs in Terminal

ops nginx

Displays logs for the nginx systemd service.


πŸ’Ύ Save Logs to a File

ops nginx -s

Logs will be saved in your current directory as:

nginx.log

With permissions set to 0644.


πŸ” Security Details

OPS implements multiple layers of protection:

  • Input Sanitization

    • Rejects any input containing /, \, or shell redirection characters
  • Privilege Separation

    • Uses fork() to isolate journalctl execution
  • Standard File Permissions

    • Owner: Read / Write
    • Group & Others: Read-only
  • No External Dependencies

    • Relies only on standard C libraries and systemd

πŸ—‚ Project Structure

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

πŸ›  Requirements

  • Linux system with:

    • systemd (journalctl)
    • gcc
    • make

πŸ“œ License

This project is licensed under the MIT License.


Built for sysadmins who’ve said β€œoh please…” one too many times. πŸ˜„

About

OPS (Oh Please, Save-me) β€” A secure C utility to quickly fetch, filter, and save systemd service logs. Because when things break, you need your logs fast

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published