mirror of
https://github.com/YunoHost-Apps/linuxdash_ynh.git
synced 2024-09-03 19:36:07 +02:00
18 lines
No EOL
388 B
Bash
Executable file
18 lines
No EOL
388 B
Bash
Executable file
#!/bin/bash
|
|
|
|
grepCmd=$(which grep)
|
|
cronLog='/var/log/syslog'
|
|
numberOfLines='50'
|
|
|
|
# Month, Day, Time, Hostname, tag, user,
|
|
|
|
result=$($grepCmd -m$numberOfLines CRON $cronLog \
|
|
| awk '{ s = ""; for (i = 6; i <= NF; i++) s = s $i " "; \
|
|
print "{\"time\" : \"" $1" "$2" "$3 "\"," \
|
|
"\"user\" : \"" $6 "\"," \
|
|
"\"message\" : \"" $5" "s "\"" \
|
|
"},"
|
|
}'
|
|
)
|
|
|
|
echo [${result%?}] |