Ubuntu – Location of PolicyKit log output

loggingpolicykit

I'm trying to debug a new PolicyKit rule that looks like this:

polkit.addRule(function(action, subject) {
    polkit.log("action=" + action);
    polkit.log("subject=" + subject);
    if (action.id == "org.freedesktop.udisks2.filesystem-unmount-others"){
        return polkit.Result.YES;
    }
});

But I can't find the output of the polkit.log() calls anywhere in /var/log/. I even tried adding a line to /etc/rsyslog.d/50-default.conf

*.*         /var/log/all

which produces lots of output, but not for polkit.log(). Where can I find the log messages for these calls?

Best Answer

From the policykit documentation:

The log() method writes the given message to the system logger prefixed with the JavaScript filename and line number. Log entries are emitted using the LOG_AUTHPRIV flag meaning that the log entries usually ends up in the file /var/log/secure. The log() method is usually only used when debugging rules. The Action and Subject types has suitable toString() methods defined for easy logging, for example,

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.policykit.exec") {
        polkit.log("action=" + action);
        polkit.log("subject=" + subject);
    }
});

will produce the following when the user runs pkexec -u bateman bash -i from a shell:

May 24 14:28:50 thinkpad polkitd[32217]: /etc/polkit-1/rules.d/10-test.rules:3: action=[Action id='org.freedesktop.policykit.exec' command_line='/usr/bin/bash -i' program='/usr/bin/bash' user='bateman' user.gecos='Patrick Bateman' user.display='Patrick Bateman (bateman)']
May 24 14:28:50 thinkpad polkitd[32217]: /etc/polkit-1/rules.d/10-test.rules:4: subject=[Subject pid=1352 user='davidz' groups=davidz,wheel, seat='seat0' session='1' local=true active=true]

This type of log events is usually found in /var/log/auth.log in Debian and its derivatives including Ubuntu.

Source: /var/log/secure not present in 14.04 ,is there any alternative?