You are not logged in.
Hello!
In setting up my server, I've been trying to figure out how to email systemd logs to myself so I can keep an eye on sshd and other services. When I was using Ubuntu 14.04, I had logwatch do all this for me, but it appears that Logwatch has trouble with systemd on Arch. As per the wiki, I copied this python script, and replicated it in /root/systemdLog.py (for testing). However, when I try to run the python script using python systemdLog.py, I get the following error:
Traceback (most recent call last):
File "systemd.py", line 3, in <module>
from systemd import journal
File "/root/systemd.py", line 3, in <module>
from systemd import journal
ImportError: cannot import name 'journal'
I tried using the commands python2 and python3 as well, with the same result. How can I fix this error?
(Some other relavant info: the script's permissions are -rwxr--r-- 1 root root)
Offline
Liar ! You didn't name your file /root/systemdLog.py, you named it /root/systemd.py and it's overriding the systemd module. Give it a different name.
Steven [ web : git ]
GPG: 327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com
Offline
Oops, a critical mistake! I renamed the file, but now I'm getting the following error (for both python3 and python2):
Traceback (most recent call last):
File "sendSystemdLogs.py", line 80, in <module>
elif firewalldStart.match(entry['MESSAGE']):
NameError: name 'firewalldStart' is not defined
Offline
Oops, a critical mistake! I renamed the file, but now I'm getting the following error (for both python3 and python2):
Traceback (most recent call last): File "sendSystemdLogs.py", line 80, in <module> elif firewalldStart.match(entry['MESSAGE']): NameError: name 'firewalldStart' is not defined
That error message is pretty clear (hint: there's a bug in the script).
Steven [ web : git ]
GPG: 327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com
Offline