diff --git a/src/pmlogger/pmlogger.c b/src/pmlogger/pmlogger.c index 3daa339..e420109 100644 --- a/src/pmlogger/pmlogger.c +++ b/src/pmlogger/pmlogger.c @@ -38,6 +38,7 @@ int parse_done = 0; int primary = 0; /* Non-zero for primary pmlogger */ char *archBase; /* base name for log files */ char *pmcd_host = NULL; +int map_localhost = 1; /* translate localhost */ struct timeval epoch; int archive_version = PM_LOG_VERS02; /* Type of archive to create */ int linger = 0; /* linger with no tasks/events */ @@ -493,7 +494,7 @@ main(int argc, char **argv) * corresponding changes are made to pmnewlog when pmlogger * options are passed through from the control file */ - while ((c = getopt(argc, argv, "c:D:h:l:Ln:Prs:T:t:uv:V:x:?")) != EOF) { + while ((c = getopt(argc, argv, "c:D:h:Hl:Ln:Prs:T:t:uv:V:x:?")) != EOF) { switch (c) { case 'c': /* config file */ @@ -532,6 +533,10 @@ main(int argc, char **argv) pmcd_host = optarg; break; + case 'H': /* do not translate localhost */ + map_localhost = 0; + break; + case 'l': /* log file name */ logfile = optarg; break; @@ -629,6 +634,7 @@ main(int argc, char **argv) Options:\n\ -c configfile file to load configuration from\n\ -h host metrics source is PMCD on host\n\ + -H do not translate localhost to host's name\n\ -l logfile redirect diagnostics and trace output\n\ -L linger, even if not primary logger instance and nothing to log\n\ -n pmnsfile use an alternative PMNS\n\ @@ -656,7 +662,9 @@ Options:\n\ /* base name for archive is here ... */ archBase = argv[optind]; - if (pmcd_host == NULL || strcmp(pmcd_host, "localhost") == 0) { + if (pmcd_host == NULL) + pmcd_host = "localhost"; + if (map_localhost && strcmp(pmcd_host, "localhost") == 0) { (void)gethostname(local, MAXHOSTNAMELEN); local[MAXHOSTNAMELEN-1] = '\0'; pmcd_host = local;