|
@@ -17,6 +17,7 @@
|
|
|
#include <faux/sysdb.h>
|
|
|
#include <klish/kcontext.h>
|
|
|
#include <klish/ksession.h>
|
|
|
+#include <klish/kexec.h>
|
|
|
#include <klish/kpath.h>
|
|
|
|
|
|
|
|
@@ -24,6 +25,8 @@ int klish_syslog(kcontext_t *context)
|
|
|
{
|
|
|
const kcontext_t *parent_context = NULL;
|
|
|
const ksession_t *session = NULL;
|
|
|
+ const kexec_t *parent_exec = NULL;
|
|
|
+ char *log_full_line = NULL;
|
|
|
|
|
|
assert(context);
|
|
|
parent_context = kcontext_parent_context(context);
|
|
@@ -32,16 +35,19 @@ int klish_syslog(kcontext_t *context)
|
|
|
session = kcontext_session(context);
|
|
|
if (!session)
|
|
|
return -1;
|
|
|
-
|
|
|
- syslog(LOG_INFO, "%u(%s) %s : %d",
|
|
|
+ parent_exec = kcontext_parent_exec(context);
|
|
|
+ if (parent_exec && (kexec_contexts_len(parent_exec) > 1)) {
|
|
|
+ log_full_line = faux_str_sprintf(", (%s)#%u",
|
|
|
+ kexec_line(parent_exec),
|
|
|
+ kcontext_pipeline_stage(parent_context));
|
|
|
+ }
|
|
|
+
|
|
|
+ syslog(LOG_INFO, "%u(%s) %s : %d%s",
|
|
|
ksession_uid(session), ksession_user(session),
|
|
|
- kcontext_line(parent_context), kcontext_retcode(parent_context));
|
|
|
+ kcontext_line(parent_context), kcontext_retcode(parent_context),
|
|
|
+ log_full_line ? log_full_line : "");
|
|
|
|
|
|
-
|
|
|
- syslog(LOG_INFO, "%u(%s) %s : %d",
|
|
|
- user ? user->pw_uid : getuid(), uname, line, retcode);
|
|
|
- free(uname);
|
|
|
-*/
|
|
|
+ faux_str_free(log_full_line);
|
|
|
|
|
|
return 0;
|
|
|
}
|