whitehat
Verified User
The pipe character is used to start and end a designated or custom token. However, I need to pass the pipe character | as text in a custom template. I'm not sure DA will let me do it.
I have read https://help.directadmin.com/item.php?id=74 Translating hardcoded DirectAdmin results . I've attempted to use that example to no avail.
I'll give you my specific situation.
I am modifying/customizing the virtualhost_2 templates. I use cronolog to parse the httpd logs. The information is piped to chronolog to write the logs. Here is what the lines that I am modifying should look like in the vhost2_template files:
Original lines:
My custom lines:
which if the pipe character were to be passed, the final httpd.conf for a domain should/will read :
I created a custom token under Custom1 at the start of the template and then use a php script (using the example from the DA link I mentioned earlier) in the template hoping to do a character replace>
and then enter my custom token into the line as such:
But the confs are wriiten, the string replace does not occur; the 'ZZZ' is passed instead a pipe character '|' and looks like this after the confs rewrite.
DA is reading my custom token, but the php script is not read/executed.
Sooooo....
This isn't a question of whether I should I use cronolog. I am going to use it. I would like to do it by just modifying the custom templates using the pipe character as a character.
I would appreciate finding out if anyone knows how to do this?
Thanks in advance
Mike Brown
I have read https://help.directadmin.com/item.php?id=74 Translating hardcoded DirectAdmin results . I've attempted to use that example to no avail.
I'll give you my specific situation.
I am modifying/customizing the virtualhost_2 templates. I use cronolog to parse the httpd logs. The information is piped to chronolog to write the logs. Here is what the lines that I am modifying should look like in the vhost2_template files:
Original lines:
Code:
CustomLog |APACHELOGDIR|/|DOMAIN|.bytes bytes
CustomLog |APACHELOGDIR|/|DOMAIN|.log |COMBINED_LOG|
ErrorLog |APACHELOGDIR|/|DOMAIN|.error.log
My custom lines:
Code:
CustomLog " | /usr/bin/cronolog |APACHELOGDIR|/%Y-%m/|DOMAIN|.bytes" bytes
CustomLog " | /usr/bin/cronolog |APACHELOGDIR|/%Y-%m/|DOMAIN|.log" |COMBINED_LOG|
ErrorLog " | /usr/bin/cronolog |APACHELOGDIR|/%Y-%m/|DOMAIN|.error.log"
which if the pipe character were to be passed, the final httpd.conf for a domain should/will read :
Code:
CustomLog " | /usr/bin/cronolog /var/log/httpd/domains/%Y-%m/mydomain.com.bytes" bytes
CustomLog " | /usr/bin/cronolog /var/log/httpd/domains/%Y-%m/mydomain.com.log" combined
ErrorLog " | /usr/bin/cronolog /var/log/httpd/domains/%Y-%m/mydomain.com.error.log"
I created a custom token under Custom1 at the start of the template and then use a php script (using the example from the DA link I mentioned earlier) in the template hoping to do a character replace>
Code:
|CUSTOM1|
|?CRONO=ZZZ /usr/bin/cronolog |
|$/usr/local/bin/php
<?php
$data = <<<END
|CRONO|
END;
$data=str_replace("ZZZ /","|",$data);
echo $data;
?>
DONE|
and then enter my custom token into the line as such:
Code:
CustomLog "|CRONO| |APACHELOGDIR|/%Y-%m/|DOMAIN|.bytes" bytes
CustomLog "|CRONO| |APACHELOGDIR|/%Y-%m/|DOMAIN|.log" |COMBINED_LOG|
ErrorLog "|CRONO| |APACHELOGDIR|/%Y-%m/|DOMAIN|.error.log"
But the confs are wriiten, the string replace does not occur; the 'ZZZ' is passed instead a pipe character '|' and looks like this after the confs rewrite.
Code:
CustomLog " ZZZ /usr/bin/cronolog /var/log/httpd/domains/%Y-%m/mydomain.com.bytes" bytes
CustomLog " ZZZ /usr/bin/cronolog /var/log/httpd/domains/%Y-%m/mydomain.com.log" combined
ErrorLog " ZZZ /usr/bin/cronolog /var/log/httpd/domains/%Y-%m/mydomain.com.error.log"
DA is reading my custom token, but the php script is not read/executed.
Sooooo....
This isn't a question of whether I should I use cronolog. I am going to use it. I would like to do it by just modifying the custom templates using the pipe character as a character.
I would appreciate finding out if anyone knows how to do this?
Thanks in advance
Mike Brown