# LTM Local Logging Question

**URL:** <https://community.f5.com/t/ltm-local-logging-question/7697>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [November 17, 2009, 6:37pm UTC](https://community.f5.com/t/ltm-local-logging-question/7697 "2009-11-17T18:37:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bodnarmatic\_110](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@bodnarmatic\_110](https://community.f5.com/u/bodnarmatic_110)\
**Post date:** [November 17, 2009, 6:37pm UTC](https://community.f5.com/t/ltm-local-logging-question/7697/1 "2009-11-17T18:37:12Z")

</div>

We’ve written a throttling iRule that parses URIs and occasionally rejects requests based on volume, content and other conditions. That part works well.

We’d like to be able to log some of these events locally for troubleshooting and audit purposes - preferably in a separate custom log in the /var/log/ directory. (not /var/log/ltm) Is this possible?

I don’t have that much experience with syslog, so working through bigpipe to manipulate syslog isn’t making this any easier.

I thought about grabbing one of the local.\* logs and using it for myself, but I’m not sure what the impact might be elsewhere.

Any thoughts/advice would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [November 17, 2009, 7:45pm UTC](https://community.f5.com/t/ltm-local-logging-question/7697/2 "2009-11-17T19:45:01Z")

</div>

Hi,

If you can log the messages to an external syslog server, you can use the log command to send the messages directly from an iRule:

[http://devcentral.f5.com/wiki/default.aspx/iRules/log](http://devcentral.f5.com/wiki/default.aspx/iRules/log)

log [-noname] [:] .[]

If a remote server isn’t an option, it would be cleaner to configure syslog-ng to send specific messages to a separate file than take a default syslog facility and use it for your logging. The concept for configuring syslog is relatively simple. You’d want to create a new filter which states which syslog facility to check and which messages to match or not match on, a new destination which states where to send the messages and a new log statement which implements the first two configuration objects.

There are some examples in this Codeshare for the pre-9.4.2 configuration:

[http://devcentral.f5.com/wiki/default.aspx/iRules/LogHttpTcpUdpToSyslogng](http://devcentral.f5.com/wiki/default.aspx/iRules/LogHttpTcpUdpToSyslogng)

You would then need to modify the existing log filter to not match the specific messages if you don’t want those messages logged to the default file.

So that’s the end goal for the syslog-ng configuration. Then you need to use the b syslog command to add this configuration to the bigip\_sys.conf file. Deb wrote a helpful article on this:

LTM 9.4.2+: Custom Syslog Configuration

[http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=155](http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=155)

And here are a few related posts:

How to filter syslog messages

[http://devcentral.f5.com/Default.aspx?tabid=53&forumid=31&tpage=1&view=topic&postid=62132](http://devcentral.f5.com/Default.aspx?tabid=53&forumid=31&tpage=1&view=topic&postid=62132)

syslog-ng filter not working

[http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&tpage=1&view=topic&postid=56442](http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&tpage=1&view=topic&postid=56442)

Aaron

---

<div class="post-metadata">

**Author:** ![Randy\_Johnson\_1](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Randy\_Johnson\_1](https://community.f5.com/u/Randy_Johnson_1)\
**Post date:** [December 14, 2009, 9:13pm UTC](https://community.f5.com/t/ltm-local-logging-question/7697/3 "2009-12-14T21:13:14Z")

</div>

This is EXACTLY what I’m looking for.Wish I could get it to work

Here is what I’m using…

when HTTP\_REQUEST {

set http\_request\_time [clock clicks -milliseconds]

set request\_log\_line "\

[HTTP::request\_num],\

[IP::remote\_addr],\

[HTTP::method],\

[HTTP::version],\

[HTTP::host],\

[LB::server],\

\“[HTTP::uri]\”,\

\“[HTTP::header value Referer]\”,

\“[HTTP::header User-Agent]\”,\

\“[HTTP::cookie value JSESSIONID]\”,\

[SSL::cipher name],\

[SSL::cipher version],\

[SSL::cipher bits]"

}

when HTTP\_RESPONSE {

set http\_response\_time [clock clicks -milliseconds]

log 10.1.3.31 local0.info "$request\_log\_line,\

[HTTP::status],\

[HTTP::payload length],\

[expr $http\_response\_time - $http\_request\_time]"

}

I use the same rule to log to the local syslog on my BigIP (log local0. "$request\_log\_line,\) and it works flawlessly.

However, when trying to log to the remote box 10.1.3.31 (Using the KIWI Syslog Daemon from Solarwinds) I get nothing. Sniffing with WireShark, I don’t see anything coming from my BigIP.

Any comments or thoughts are MOST welcome !!

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [December 14, 2009, 9:20pm UTC](https://community.f5.com/t/ltm-local-logging-question/7697/4 "2009-12-14T21:20:16Z")

</div>

Which LTM version are you running? For 9.4.2+ it would probably be easiest and most efficient to use the log option. For previous versions, how have you configured syslog-ng.conf to send the messages remotely?

Aaron

---

<div class="post-metadata">

**Author:** ![Randy\_Johnson\_1](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Randy\_Johnson\_1](https://community.f5.com/u/Randy_Johnson_1)\
**Post date:** [December 14, 2009, 9:43pm UTC](https://community.f5.com/t/ltm-local-logging-question/7697/5 "2009-12-14T21:43:11Z")

</div>

Thanks, Hoolio !

This is BIG-IP 9.4.4 Build 65.1 Final -

What you suggest is exactly what I want to do… in my remote-logging iRule, ive put

log 10.1.3.31 local0.info "$request\_log\_line,

which seems to relate to your suggestion..

log [-noname] [:] .[]

---

<div class="post-metadata">

**Author:** ![Randy\_Johnson\_1](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Randy\_Johnson\_1](https://community.f5.com/u/Randy_Johnson_1)\
**Post date:** [December 14, 2009, 10:30pm UTC](https://community.f5.com/t/ltm-local-logging-question/7697/6 "2009-12-14T22:30:43Z")

</div>

Got it figgered out.

Syslog traffic wasn’t traveling over my management network.

all is well, this is KILLER !

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [December 15, 2009, 9:18am UTC](https://community.f5.com/t/ltm-local-logging-question/7697/7 "2009-12-15T09:18:52Z")

</div>

Yes, I think because TMM sends the syslog messages directly (bypassing syslog-ng) the syslog server must be on a TMM network--not the management.

Glad you got this working. It would be good to consider upgrading to 9.4.8 when you have a chance.

Aaron
