0

I am logging cookie headers, some cookies may have due date, some others not, the same is tru for other cookie parameters, I need to implement a centrilaized logging, so before sending those to logstash I want to transform syslog to json. How can I do that?

Edik Mkoyan
  • 115
  • 5

1 Answers1

0

My suggestion is you format logs in apache as json previously.

As per requested here is an example I got on how to use LogFormart in httpd so your apache logs are logged directly like json:

LogFormat "{\"time\":\"%{%Y-%m-%dT%H:%M:%S%z}t\",\"clientip\":\"%a\",\"duration\": %D,\"status\": %>s,\"request\": \"%U%q\",\"uri\": \"%U\",\"remote_user\": \"%u\",\"query_string\": \"%q\",\"document\": \"%f\",\"bytes\": %B,\"request_method\": \"%m\",\"referer\": \"%{Referer}i\",\"useragent\": \"%{User-agent}i\",\"vhost\": \"%{Host}i\" }" json
Daniel Ferradal
  • 2,415
  • 1
  • 8
  • 13
  • thanks a lot, however this is only for crafting json from apache mod_log variables. I use {VARNAME}C for now, but that is not a good solution, as my goal is to collect all cookies, even the ones I am not aware of. – Edik Mkoyan Jan 30 '18 at 11:52