Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 21b5fafcd6e31146d47fa3ef56cc43452040680d
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Feb 20 14:39:23 2015 +0100
[frontend] [rhbz:#1185959] RFE: Present statistics about project popularity : logstash
config)
---------------------------------------------------------------
frontend/conf/logstash.conf | 41 +++++++++++++++++++++++++++++++++++++++++
frontend/copr-frontend.spec | 5 +++++
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/frontend/conf/logstash.conf b/frontend/conf/logstash.conf
new file mode 100644
index 0000000..82aa01d
--- /dev/null
+++ b/frontend/conf/logstash.conf
@@ -0,0 +1,41 @@
+input {
+ file {
+ path => "/var/log/httpd/access_log"
+ type => "httpd-access"
+ }
+ # file {
+ # path => "/var/log/httpd/error_log"
+ # type => "httpd-error"
+ # }
+}
+
+filter {
+ grok {
+ type => "httpd-access"
+ pattern => "%{COMBINEDAPACHELOG}"
+ }
+}
+
+output {
+ if [type] == "httpd-access" {
+ if ".repo" in [request] and "stats_rcv" not in [request] {
+ http {
+ url => "http://127.0.0.1/stats_rcv/from_logstash"
+ format => "json"
+ http_method => "post"
+ message => "foobar"
+ }
+ }
+ #file {
+ # path => "/var/log/logstash/web.log"
+ # codec => rubydebug {}
+ #
+ #}
+ }
+
+ # file {
+ # path => "/var/log/logstash/all.log"
+ # codec => rubydebug {}
+ # }
+
+}
diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec
index 49b2b8d..3df1de9 100644
--- a/frontend/copr-frontend.spec
+++ b/frontend/copr-frontend.spec
@@ -57,6 +57,7 @@ Requires: python-flexmock
Requires: python-mock
Requires: python-decorator
Requires: yum
+Requires: logstash
%if 0%{?rhel} < 7 && 0%{?rhel} > 0
BuildRequires: python-argparse
%endif
@@ -128,7 +129,9 @@ touch %{buildroot}%{_sharedstatedir}/copr/data/copr.db
install -d %{buildroot}%{_var}/log/copr
install -d %{buildroot}%{_sysconfdir}/logrotate.d
+install -d %{buildroot}%{_sysconfdir}/logstash.d
cp -a conf/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
+cp -a conf/logstash.conf %{buildroot}%{_sysconfdir}/logstash.d/copr_frontend.conf
touch %{buildroot}%{_var}/log/copr/frontend.log
%check
@@ -147,6 +150,7 @@ useradd -r -g copr-fe -G copr-fe -d %{_datadir}/copr/coprs_frontend -s
/bin/bash
%post
service httpd condrestart
+service logstash condrestart
%files
%license LICENSE
@@ -157,6 +161,7 @@ service httpd condrestart
%{_datadir}/copr/coprs_frontend
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
+%config(noreplace) %{_sysconfdir}/logstash.d/copr_frontend.conf
%defattr(-, copr-fe, copr-fe, -)
%dir %{_sharedstatedir}/copr/data