# Nginx LUA

**URL:** <https://www.ruby-forum.com/t/nginx-lua/242239>\
**Category:** NGINX\
**Created:** [June 7, 2015, 4:41pm UTC](https://www.ruby-forum.com/t/nginx-lua/242239 "2015-06-07T16:41:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [June 7, 2015, 4:41pm UTC](https://www.ruby-forum.com/t/nginx-lua/242239/1 "2015-06-07T16:41:38Z")

</div>

Can anyone please help me with a lua configuration which I can embedded  
into  
nginx.conf to send the following sepaately in access log.

user\_agent\_os  
user\_agent\_browser  
user\_agent\_version

At present all these fields are embedded in http\_user\_agent and I am  
writing  
parser to parse at the receiver end. I am looking for some input where I  
can  
send them separately as different fields from Nginx itself.

Posted at Nginx Forum:

> **[Nginx LUA](https://forum.nginx.org/read.php?2,259422,259422#msg-259422)**
>
> Can anyone please help me with a lua configuration which I can embedded into nginx.conf to send the following sepaately in access log. user\_agent\_os user\_agent\_browser user\_agent\_version At present all these fields are embedded in http\_user\_agent and...

---

<div class="post-metadata">

**Author:** ![nginxsantos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/76d3ee/32.png) [@nginxsantos](https://www.ruby-forum.com/u/nginxsantos)\
**Post date:** [June 14, 2015, 4:55am UTC](https://www.ruby-forum.com/t/nginx-lua/242239/2 "2015-06-14T04:55:34Z")

</div>

Hello!

On Sun, Jun 7, 2015 at 10:41 PM, nginxsantos wrote:

> 

You need to parse the User-Agent header value yourself in Lua with  
regexes or something. Not sure if there’s a ready-to-use 3rd-party Lua  
libraries that can already parse that for you.

BTW, you’re recommended to post ngx\_lua related questions to the  
openresty-en mailing list instead. Please see  
[OpenResty® - High-Concurrency Web Platform Built on Nginx + LuaJIT](https://openresty.org/#Community) for more details. Thanks.

Best regards,  
-agentzh

---

<div class="post-metadata">

**Author:** ![nginxsantos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/76d3ee/32.png) [@nginxsantos](https://www.ruby-forum.com/u/nginxsantos)\
**Post date:** [June 15, 2015, 6:04am UTC](https://www.ruby-forum.com/t/nginx-lua/242239/3 "2015-06-15T06:04:33Z")

</div>

I would suggest using some log parser. You can find some by searching.  
Those “for Apache” ones would also work. If you know some python or  
shell  
script, writing one yourself won’t take more than a few minutes.  
Analyzing access log on the fly just doesn’t make much sense.
