acrn_log: Fix log path to comply with Linux FSSTD

Change logging path to /var/log/acrnlog to be compliant with the Linux
FSSTD, see https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html.

Tracked-On: #6688
Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
This commit is contained in:
Helmut Buchsbaum 2022-05-05 08:32:48 +02:00 committed by acrnsi-robot
parent 78b64c21b3
commit 549d9004e9
3 changed files with 9 additions and 9 deletions

View File

@ -48,7 +48,7 @@
<trigger id="5" enable="true"> <trigger id="5" enable="true">
<name>t_acrnlog_last</name> <name>t_acrnlog_last</name>
<type>file</type> <type>file</type>
<path>/tmp/acrnlog/acrnlog_last.[*]</path> <path>/var/log/acrnlog/acrnlog_last.[*]</path>
</trigger> </trigger>
</triggers> </triggers>
@ -89,13 +89,13 @@
<log id='5' enable='true'> <log id='5' enable='true'>
<name>acrnlog_cur</name> <name>acrnlog_cur</name>
<type>file</type> <type>file</type>
<path>/tmp/acrnlog/acrnlog_cur.[-1]</path> <path>/var/log/acrnlog/acrnlog_cur.[-1]</path>
<lines>500</lines> <lines>500</lines>
</log> </log>
<log id='6' enable='true'> <log id='6' enable='true'>
<name>acrnlog_last</name> <name>acrnlog_last</name>
<type>file</type> <type>file</type>
<path>/tmp/acrnlog/acrnlog_last.[*]</path> <path>/var/log/acrnlog/acrnlog_last.[*]</path>
</log> </log>
</logs> </logs>

View File

@ -12,7 +12,7 @@ as a Service VM service at boot, capturing two kinds of logs:
- log of the running hypervisor - log of the running hypervisor
- log of the last running hypervisor if it crashed and the logs remain - log of the last running hypervisor if it crashed and the logs remain
Log files are saved in ``/tmp/acrnlog/``, so the log files would be lost Log files are saved in ``/var/log/acrnlog/``, so the log files would be lost
after a system reset. after a system reset.
Usage Usage

View File

@ -43,7 +43,7 @@ struct hvlog_file {
}; };
static struct hvlog_file cur_log = { static struct hvlog_file cur_log = {
.path = "/tmp/acrnlog/acrnlog_cur", .path = "/var/log/acrnlog/acrnlog_cur",
.fd = -1, .fd = -1,
.left_space = 0, .left_space = 0,
.index = ~0, .index = ~0,
@ -51,7 +51,7 @@ static struct hvlog_file cur_log = {
}; };
static struct hvlog_file last_log = { static struct hvlog_file last_log = {
.path = "/tmp/acrnlog/acrnlog_last", .path = "/var/log/acrnlog/acrnlog_last",
.fd = -1, .fd = -1,
.left_space = 0, .left_space = 0,
.index = ~0, .index = ~0,
@ -433,7 +433,7 @@ static void display_usage(void)
"\t-s: size limitation for each log file, in MB.\n" "\t-s: size limitation for each log file, in MB.\n"
"\t 0 means no limitation.\n" "\t 0 means no limitation.\n"
"\t-n: how many files you would like to keep on disk\n" "\t-n: how many files you would like to keep on disk\n"
"[Output] capatured log files under /tmp/acrnlog/\n"); "[Output] capatured log files under /var/log/acrnlog/\n");
} }
static int parse_opt(int argc, char *argv[]) static int parse_opt(int argc, char *argv[])
@ -495,9 +495,9 @@ int main(int argc, char *argv[])
if (parse_opt(argc, argv)) if (parse_opt(argc, argv))
return -1; return -1;
ret = mk_dir("/tmp/acrnlog"); ret = mk_dir("/var/log/acrnlog");
if (ret) { if (ret) {
printf("Cannot create /tmp/acrnlog. Error: %s\n", printf("Cannot create /var/log/acrnlog. Error: %s\n",
strerror(errno)); strerror(errno));
return ret; return ret;
} }