Advertisement
Guest User

Syslog-ng-to-Fluentd

a guest
Nov 26th, 2015
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ######################### Fluentd Conf ##################################
  2.  
  3. <source>
  4. type syslog
  5. port 5140
  6. bind 0.0.0.0
  7. format json
  8. tag proxy
  9. </source>
  10.  
  11. <match proxy>
  12. type file
  13. path /var/log/td-agent/nginx
  14. </match>
  15.  
  16.  
  17. ########################## Syslog-ng Conf #################################
  18.  
  19.  
  20. Template
  21. template FluentdFormat { template("<${PRI}> ${ISODATE} ${HOST} ${PROGRAM} ${PID} $MSG");
  22. template_escape(no);
  23. };
  24.  
  25.  
  26. source s_nginx {
  27. file ("/var/log/nginx/proxy_access.log" );
  28. };
  29.  
  30. destination d_fluentd {
  31. udp("xxx.xxx.xxx.xxx" port(5140) template(FluentdFormat));
  32.  
  33. };
  34.  
  35. log { source(s_nginx); destination(d_fluentd);};
  36.  
  37.  
  38.  
  39. ############## Output Nginx #######################################
  40.  
  41.  
  42. {"xfor": "-", "real-ip": "191.22.160.42", "timestamp": "26/Nov/2015:13:47:59 -0200", "request": "GET /api/v3/notification/current HTTP/1.1", "request_time": "0.252", "bytes": "0", "referer": "-", "user_agent": "Dalvik/1.6.0 (Linux; U; Android 4.4.4; SM-G360M Build/KTU84P)", "upstream_time": "0.252", "pipe": ".", "msisdn": "-", "x_call_id": "-", "mip_access_token": "7c7037f0-f0a7-11e2-b778-0800200c9a66", "frontend": "-", "status": "204", "mip_device_id": "c15374e6c62a8555434948483bc9ec3cdd89b712", "mip_app_version_id": "73", "mip_app_version": "4.0.0"}
  43.  
  44.  
  45.  
  46. ###################### Input fluentd ##############################
  47.  
  48.  
  49. 2015-11-25 21:36:45 +0000 [warn]: pattern not match: " 2015-11-25T19:36:45-02:00 proxy6 {\"xfor\" \"-\", \"real-ip\": \"177.79.20.185\", \"timestamp\": \"25/Nov/2015:19:36:44 -0200\", \"request\": \"GET /api/v2/medias/categories/apps-store-mais-baixados?apiLevel=22&firstResult=10&maxResult=10 HTTP/1.1\", \"request_time\": \"0.278\", \"bytes\": \"40918\", \"referer\": \"-\", \"user_agent\": \"Mozilla/5.0 (Linux; Android 5.1.1; SM-G531BT Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/46.0.2490.76 Mobile Safari/537.36\", \"upstream_time\": \"0.146\", \"pipe\": \".\", \"msisdn\": \"-\", \"x_call_id\": \"-\", \"mip_access_token\": \"b477157-c29d22dc-cce7e51-f9a3a95ee3\", \"frontend\": \"samsungappsclub\", \"status\": \"200\", \"mip_device_id\": \"8fcc7f0535af2952557fa9e80a4126f4b2b08a88\", \"mip_app_version_id\": \"48\", \"mip_app_version\": \"1.0.0\"}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement