From ba6200857c02914ec1df3e06d6ba701b5bee5aaf Mon Sep 17 00:00:00 2001 From: James Jones Date: Mon, 9 May 2016 12:42:04 -0400 Subject: [PATCH 1/3] Added daily logrotate to pcap_service. I also verified that it created the file and I tested the execution in the full-dev-platform image using the logrotate -f option (force). It properly rotated to /var/log/metron_pcapservice.log.1. --- .../metron-pcapservice-logrotate.yml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml diff --git a/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml b/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml new file mode 100644 index 0000000000..4bcc131b9c --- /dev/null +++ b/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#Metron pcapService +/var/log/metron_pcapservice.log { + {{ metron_pcapservice_logrotate_frequency }} + rotate {{ metron_pcapservice_logrotate_retention }} + missingok + notifempty + copytruncate +} \ No newline at end of file From 41517ac1273f21a08965d039ef0e6a2cf51e7fb8 Mon Sep 17 00:00:00 2001 From: James Jones Date: Mon, 9 May 2016 12:42:28 -0400 Subject: [PATCH 2/3] Added daily logrotate to pcap_service. I also verified that it created the file and I tested the execution in the full-dev-platform image using the logrotate -f option (force). It properly rotated to /var/log/metron_pcapservice.log.1. --- .../roles/metron_pcapservice/defaults/main.yml | 2 ++ metron-deployment/roles/metron_pcapservice/tasks/main.yml | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/metron-deployment/roles/metron_pcapservice/defaults/main.yml b/metron-deployment/roles/metron_pcapservice/defaults/main.yml index c19470a6d8..7081db4130 100644 --- a/metron-deployment/roles/metron_pcapservice/defaults/main.yml +++ b/metron-deployment/roles/metron_pcapservice/defaults/main.yml @@ -24,3 +24,5 @@ pcapservice_port: 8081 hbase_config_path: "/etc/hbase/conf" query_hdfs_path: "/tmp" pcap_hdfs_path: "/apps/metron/pcap" +metron_pcapservice_logrotate_frequency: daily +metron_pcapservice_logrotate_retention: 30 diff --git a/metron-deployment/roles/metron_pcapservice/tasks/main.yml b/metron-deployment/roles/metron_pcapservice/tasks/main.yml index 9afdc3bc2f..b4aeb32916 100644 --- a/metron-deployment/roles/metron_pcapservice/tasks/main.yml +++ b/metron-deployment/roles/metron_pcapservice/tasks/main.yml @@ -16,3 +16,9 @@ # --- - include: pcapservice.yml + +- name: Create Logrotate Script for metron_pcapservice + template: + src: "metron-pcapservice-logrotate.yml" + dest: "/etc/logrotate.d/metron-pcapservice" + mode: 0644 \ No newline at end of file From 83785800b8027049dd4d488ab95ab25b8476ebd8 Mon Sep 17 00:00:00 2001 From: Jim Jones Date: Mon, 9 May 2016 17:43:24 -0400 Subject: [PATCH 3/3] added newlines to files so github does not complain --- metron-deployment/roles/metron_pcapservice/defaults/main.yml | 1 + metron-deployment/roles/metron_pcapservice/tasks/main.yml | 3 ++- .../templates/metron-pcapservice-logrotate.yml | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/metron-deployment/roles/metron_pcapservice/defaults/main.yml b/metron-deployment/roles/metron_pcapservice/defaults/main.yml index 7081db4130..6be114d5ee 100644 --- a/metron-deployment/roles/metron_pcapservice/defaults/main.yml +++ b/metron-deployment/roles/metron_pcapservice/defaults/main.yml @@ -26,3 +26,4 @@ query_hdfs_path: "/tmp" pcap_hdfs_path: "/apps/metron/pcap" metron_pcapservice_logrotate_frequency: daily metron_pcapservice_logrotate_retention: 30 + diff --git a/metron-deployment/roles/metron_pcapservice/tasks/main.yml b/metron-deployment/roles/metron_pcapservice/tasks/main.yml index b4aeb32916..ed33354459 100644 --- a/metron-deployment/roles/metron_pcapservice/tasks/main.yml +++ b/metron-deployment/roles/metron_pcapservice/tasks/main.yml @@ -21,4 +21,5 @@ template: src: "metron-pcapservice-logrotate.yml" dest: "/etc/logrotate.d/metron-pcapservice" - mode: 0644 \ No newline at end of file + mode: 0644 + diff --git a/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml b/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml index 4bcc131b9c..f6ff2711ef 100644 --- a/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml +++ b/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml @@ -22,4 +22,5 @@ missingok notifempty copytruncate -} \ No newline at end of file +} +