Skip to main content
Glama
journal_tail.sh1.21 kB
#!/bin/bash # GEP MCP Tool: Journal Tail # # Description: Tail systemd journal logs with filtering # GEP Profile: Medium entropy (0.25), read-only # Risk Level: 2 (low) # # Usage: journal_tail.sh [lines] [priority] [unit] set -euo pipefail LINES="${1:-50}" PRIORITY="${2:-info}" # emerg, alert, crit, err, warning, notice, info, debug UNIT="${3:-}" # Build journalctl command CMD="journalctl -n $LINES --no-pager" # Add priority filter case "$PRIORITY" in emerg|alert|crit) CMD="$CMD -p 0..2" ;; err) CMD="$CMD -p err" ;; warning) CMD="$CMD -p warning" ;; notice|info) CMD="$CMD -p notice" ;; debug) CMD="$CMD -p debug" ;; *) CMD="$CMD -p info" ;; esac # Add unit filter if specified if [ -n "$UNIT" ]; then CMD="$CMD -u $UNIT" fi # Execute and format as JSON echo "{" echo " \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"," echo " \"lines\": $LINES," echo " \"priority\": \"$PRIORITY\"," echo " \"unit\": \"$UNIT\"," echo " \"entries\": [" $CMD --output=json 2>/dev/null | while IFS= read -r line; do echo " $line," done | sed '$ s/,$//' echo " ]" echo "}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/darkt22002/gep-mcp-motor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server