# Copyright 2020 Adarsh yadav # # Licensed 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. apiVersion: v1 kind: ConfigMap metadata: name: fluentd-config data: index_template.json: | { "index_patterns": [ "node*" ], "settings": { "index.lifecycle.name": "delete_policy", "number_of_replicas": 1 } } fluent.conf: | @type forward port 24224 bind 0.0.0.0 tag log #tag the .dat file @type rewrite_tag_filter #Trex data key log_path pattern /\/tmp\/result.*\/.*counts.dat/ tag countdat.${tag} key log_path pattern /\/tmp\/result.*\/.*errors.dat/ tag errordat.${tag} #Spirent data key log_path pattern /\/tmp\/result.*\/stc-liveresults.dat.tx/ tag stcdattx.${tag} key log_path pattern /\/tmp\/result.*\/stc-liveresults.dat.rx/ tag stcdatrx.${tag} #Ixia data key log_path pattern /\/tmp\/result.*\/.*Statistics.csv/ tag ixia.${tag} #log files key log_path pattern /vsperf-overall/ tag vsperf.${tag} key log_path pattern /vswitchd/ tag vswitchd.${tag} key log_path pattern /\/var\/log\/userspace/ tag userspace.${tag} key log_path pattern /\/var\/log\/sriovdp/ tag sriovdp.${tag} key log_path pattern /\/var\/log\/pods/ tag pods.${tag} #to find error @include error.conf #to parse time-series data @include time-series.conf #to calculate time analysis @include time-analysis.conf #give tag 'node1' if host is worker and tag 'node4' if host is pod12-node4 @type rewrite_tag_filter key host pattern /pod12-node4/ tag node4 key host pattern /worker/ tag node1 @type elasticsearch_genid hash_id_key _hash1 #send the node1 log to node1 index in elasticsearch @type copy @type elasticsearch host logging-es-http port 9200 scheme https ssl_verify false user "#{ENV['FLUENT_ELASTICSEARCH_USER']}" password "#{ENV['FLUENT_ELASTICSEARCH_PASSWORD']}" logstash_format true logstash_prefix node1 logstash_dateformat %Y%m%d flush_interval 1s id_key _hash1 remove_keys _hash1 enable_ilm true application_name ${tag} index_date_pattern "" ilm_policy_id delete_policy template_name delpol-test template_file /fluentd/etc/index_template.json ilm_policy { "policy": { "phases": { "delete": { "min_age": "3m", "actions": { "delete": {} } } } } } @type stdout @type elasticsearch_genid hash_id_key _hash4 #send the node4 log to node4 index in elasticsearch @type copy @type elasticsearch host logging-es-http port 9200 scheme https ssl_verify false user "#{ENV['FLUENT_ELASTICSEARCH_USER']}" password "#{ENV['FLUENT_ELASTICSEARCH_PASSWORD']}" logstash_format true logstash_prefix node4 logstash_dateformat %Y%m%d flush_interval 1s id_key _hash4 remove_keys _hash4 enable_ilm true application_name ${tag} index_date_pattern "" ilm_policy_id delete_policy template_name delpol-test template_file /fluentd/etc/index_template.json ilm_policy { "policy": { "phases": { "delete": { "min_age": "3m", "actions": { "delete": {} } } } } } @type stdout error.conf: | @type parser reserve_data true key_name msg emit_invalid_record_to_error false @type regexp expression /(?\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}).*(?Failed to run test|Failed to execute in '30' seconds|\('Result', 'Failed'\)|could not open socket: connection refused|Input\/output error)/ @type parser reserve_data true key_name msg emit_invalid_record_to_error false @type regexp expression /(?\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z).*(?dpdk\|ERR\|EAL: Error - exiting with code: 1|Failed to execute in '30' seconds|dpdk\|ERR\|EAL: Driver cannot attach the device|dpdk\|EMER\|Cannot create lock on)/ @type parser reserve_data true key_name msg emit_invalid_record_to_error false @type regexp expression /(?\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z).*dpdk\|ERR\|VHOST_CONFIG:.*(?device not found)/ time-series.conf: | #parse *counts.dat @type parser key_name msg reserve_data true emit_invalid_record_to_error false @type regexp expression /^(?[\.\d]*),(?\d*),(?\d*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*)$/ types rx_port:integer,tx_port:integer,rx_pkts:float,tx_pkts:float,rx_pps:float,tx_pps:float,rx_bps_num:float,rx_bps_den:float,tx_bps_num:float,tx_bps_den:float #parse *errors.dat @type parser key_name msg reserve_data true emit_invalid_record_to_error false @type regexp expression /^(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*)$/ types ts:integer,dropped:integer,ooo:integer,dup:integer,seq_too_high:integer,seq_too_low:integer #parse stc-liveresults.dat.tx @type parser key_name msg reserve_data true emit_invalid_record_to_error false @type regexp expression /^(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*)$/ types ts:integer,StrId:integer,BlkId:integer,FrCnt:integer,FrRate:integer,ERxFrCnt:integer,OctCnt:integer,OctRate:integer,bitCnt:integer,bitRate:integer #parse stc-liveresults.dat.rx @type parser key_name msg reserve_data true emit_invalid_record_to_error false @type regexp expression /^(?[\.\d]*),(.*, |)(?.*),(?[\.\d]*),(?[\.\d]*),(?.*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*),(?[\.\d]*)$/ types ts:integer,DrpFrCnt:integer,SeqRnLen:integer,FrCnt:integer,FrRate:integer,MaxLat:integer,MinLat:integer,OctCnt:integer,OctRate:integer time-analysis.conf: | # 1. Test Duration - Duration Between: first line and last line. # 2. Setup Duration - Duration Between: Creating result directory TO Class found --- # 3. Traffic Duration - Duration between From Starting traffic at 0.1 Gbps speed TO Traffic Results # 4. Iteration Durations -- Example: Duration between - Starting traffic at 10.0 Gbps TO Starting traffic at 5.0 Gbps speed # 5. Reporting Duration - Duration between From Traffic Results TO Write results to file # 6. Vswitchd start Duration- Duration between From Starting vswitchd... TO send_traffic with @type rewrite_tag_filter key msg pattern /Creating result directory:/ tag firstline.${tag} key msg pattern /Write results to file/ tag lastline.${tag} key msg pattern /Class found/ tag setupend.${tag} key msg pattern /Starting traffic at 0.1 Gbps speed/ tag trafficstart.${tag} key msg pattern /Traffic Results/ tag trafficend.${tag} key msg pattern /Starting traffic at 10.0 Gbps/ tag iterationstart.${tag} key msg pattern /Starting traffic at 5.0 Gbps speed/ tag iterationend.${tag} key msg pattern /Starting vswitchd/ tag vswitchstart.${tag} key msg pattern /send_traffic/ tag vswitch.${tag} key msg pattern ^.*$ tag logs.${tag} ############################################################################################# #save the starting log and append that log in ending log ############################################################################################# @type record_transformer enable_ruby true msg ${$vswitch_start="";$reportstart="";$firstline="";$traffic_start="";$iteration_start="";$firstline = record["msg"];return record["msg"];} @type record_transformer enable_ruby true newmsg ${record["msg"]+" | "+$firstline + " | "+ $reportstart} @type record_transformer enable_ruby true newmsg ${record["msg"]+" "+$firstline} @type record_transformer enable_ruby true msg ${if $traffic_start.eql?("");$traffic_start=record["msg"];end;return record["msg"];} @type record_transformer enable_ruby true newmsg ${if $reportstart.eql?("");$reportstart=record["msg"];end;return record["msg"]+" "+$traffic_start;} @type record_transformer enable_ruby true msg ${if $iteration_start.eql?("");$iteration_start=record["msg"];end;return record["msg"];} @type record_transformer enable_ruby true newmsg ${record["msg"]+" "+$iteration_start} @type record_transformer enable_ruby true msg ${$vswitch_start=record["msg"];return record["msg"];} @type record_transformer enable_ruby true newmsg ${record["msg"]+" "+$vswitch_start} ############################################################################################# #parse time from the log ############################################################################################# @type parser key_name newmsg reserve_data true remove_key_name_field true @type regexp expression /^(?.*) : Class found: Trex. (?.*) : .*$/ @type parser key_name newmsg reserve_data true remove_key_name_field true @type regexp expression /^(?.*) : Starting traffic at 5.0 Gbps speed (?.*) : Starting traffic at 10.0 Gbps speed$/ @type parser key_name newmsg reserve_data true remove_key_name_field true @type regexp expression /^(?.*) : send_traffic with <.*> (?.*) : Starting vswitchd...$/ @type parser key_name newmsg reserve_data true remove_key_name_field true @type regexp expression /^(?.*) : Traffic Results: (?.*) : Starting traffic at 0.1 Gbps speed/ @type parser key_name newmsg reserve_data true remove_key_name_field true @type regexp expression /^(?.*) : Write results to file: .* \| (?.*) : Creating result directory: .* \| (?.*) : Traffic Results:$/ ############################################################################################# #calculate time ############################################################################################# @type record_transformer enable_ruby setup_duration ${ require 'time';Time.parse(record["setupend"])-Time.parse(record["setupstart"]); } @type record_transformer enable_ruby iteration_duration ${ require 'time';Time.parse(record["iterationend"])-Time.parse(record["iterationstart"]); } @type record_transformer enable_ruby vswitch_duration ${ require 'time';Time.parse(record["vswitch"])-Time.parse(record["vswitchstart"]); } @type record_transformer enable_ruby traffic_duration ${ require 'time';Time.parse(record["trafficend"])-Time.parse(record["trafficstart"]); } @type record_transformer enable_ruby test_duration ${ require 'time';Time.parse(record["lastline"])-Time.parse(record["firstline"]); } report_duration ${ require 'time';Time.parse(record["lastline"])-Time.parse(record["reportstart"]); } #############################################################################################