Quote:
Originally Posted by mariosipad
@teejcee
What system is your COPS running on?
For example:
- linux and apache
- windows and WAMP (Apache)
- other webs server like ngnix
- Synology with web server
- Raspberry Pi with apache or ngnix
I have made some progress with Linux (Debian) and Apache so maybe I can share?
|
@mariosipad
I'm running mint linux & apache2 on a lttle server. COPS is kept up to date via owncloud which syncs the COPS data with Calibre on a laptop.
I have made progress since my last reply. I took a look at the link you sent but , like you, didn't get far with it.
Since then, I've now got a cron job running every morning which reports successful user logins. Yaaaayyyyyy!!!!! The first live run was in fact this morning and all worked as advertised.
It is not very sophisticated but achieves my goal.
I found that the apache2 log file, other_vhosts_access.log, if enabled,
contained heaps of log lines, most of which were generated by owncloud.
However, a closer study revealed that a login to COPS also generated a lot of entries. It was the a matter of identifying a line which was unique for each login, which did in fact exist.The text "getJSON" appeared in one line. I then created my cron job...I must give some cedit to an old mate of mine for assistance. Thanks Garry.
Create your script in ~/bin....call it whatever and enter code below
( If you haven't already, add your ~/bin to $PATH )
Code:
#!/bin/bash
# email details of COPS user logins for past 24 hours...
DATE=$(date +%d-%b-%Y)
LOGFILE="pathname-to-log-file"
# mine is /var/log/apache2/other_vhosts_access.log
cd ~
grep getJSON $LOGFILE | mail -s "subject line $DATE" email-address
#eg "User Logins for $DATE" me@my-email-address.whatever
Now add an entry to cron...eg
crontab -e
Code:
15 6 * * * /home/your-username/bin/the-script-name.sh
Equates to "at 0615, every day, run this script
I get a lot more information than just user & IP address , which is a bonus.
If you've any questions, fire away, and thanks for your input on this. I'd
be interested on the approach you're looking at.
Cheers,
TC