Forum Discussion
iRule HSL logging question with user specified text
- Oct 20, 2020
Hello Martin.
With a request-logging profile you can set any kind of format in the template field.
An example of CEF format:
CEF:0|F5|MyEnv|1|sip=$CLIENT_IP sprt=$CLIENT_PORT snatip=$SNAT_IP snatprt=$SNAT_PORT dstip=$SERVER_IP dstprt=$SERVER_PORT dhost=$BIGIP_HOSTNAME apm=$X_APM
Where 'X_APM can be configured injecting an HTTP header:
when HTTP_REQUEST { HTTP::header replace X_APM [ACCESS::session data get session.custom.name] } when HTTP_REQUEST_RELEASE { HTTP::header remove X_APM }
---
In case you still want to use an iRule, you can get those parameters with:
1) Hostname
$static::tcl_platform(machine)
2) Time
set curtime [clock seconds] set formattedtime [clock format $curtime] log "$curtime seconds since epoch, $formattedtime"
Output: 1129552706 seconds since epoch, Mon Oct 17 07:38:26 CDT 2005
Regards,
Dario.
Hello Martin.
With a request-logging profile you can set any kind of format in the template field.
An example of CEF format:
CEF:0|F5|MyEnv|1|sip=$CLIENT_IP sprt=$CLIENT_PORT snatip=$SNAT_IP snatprt=$SNAT_PORT dstip=$SERVER_IP dstprt=$SERVER_PORT dhost=$BIGIP_HOSTNAME apm=$X_APM
Where 'X_APM can be configured injecting an HTTP header:
when HTTP_REQUEST {
HTTP::header replace X_APM [ACCESS::session data get session.custom.name]
}
when HTTP_REQUEST_RELEASE {
HTTP::header remove X_APM
}
---
In case you still want to use an iRule, you can get those parameters with:
1) Hostname
$static::tcl_platform(machine)
2) Time
set curtime [clock seconds]
set formattedtime [clock format $curtime]
log "$curtime seconds since epoch, $formattedtime"
Output: 1129552706 seconds since epoch, Mon Oct 17 07:38:26 CDT 2005
Regards,
Dario.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com