001/*
002 * Copyright 2012-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.actuate.autoconfigure.metrics.export.elastic;
018
019import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.StepRegistryProperties;
020import org.springframework.boot.context.properties.ConfigurationProperties;
021
022/**
023 * {@link ConfigurationProperties} for configuring Elastic metrics export.
024 *
025 * @author Andy Wilkinson
026 * @since 2.1.0
027 */
028@ConfigurationProperties(prefix = "management.metrics.export.elastic")
029public class ElasticProperties extends StepRegistryProperties {
030
031        /**
032         * Host to export metrics to.
033         */
034        private String host = "http://localhost:9200";
035
036        /**
037         * Index to export metrics to.
038         */
039        private String index = "metrics";
040
041        /**
042         * Index date format used for rolling indices. Appended to the index name, preceded by
043         * a '-'.
044         */
045        private String indexDateFormat = "yyyy-MM";
046
047        /**
048         * Name of the timestamp field.
049         */
050        private String timestampFieldName = "@timestamp";
051
052        /**
053         * Whether to create the index automatically if it does not exist.
054         */
055        private boolean autoCreateIndex = true;
056
057        /**
058         * Login user of the Elastic server.
059         */
060        private String userName = "";
061
062        /**
063         * Login password of the Elastic server.
064         */
065        private String password = "";
066
067        public String getHost() {
068                return this.host;
069        }
070
071        public void setHost(String host) {
072                this.host = host;
073        }
074
075        public String getIndex() {
076                return this.index;
077        }
078
079        public void setIndex(String index) {
080                this.index = index;
081        }
082
083        public String getIndexDateFormat() {
084                return this.indexDateFormat;
085        }
086
087        public void setIndexDateFormat(String indexDateFormat) {
088                this.indexDateFormat = indexDateFormat;
089        }
090
091        public String getTimestampFieldName() {
092                return this.timestampFieldName;
093        }
094
095        public void setTimestampFieldName(String timestampFieldName) {
096                this.timestampFieldName = timestampFieldName;
097        }
098
099        public boolean isAutoCreateIndex() {
100                return this.autoCreateIndex;
101        }
102
103        public void setAutoCreateIndex(boolean autoCreateIndex) {
104                this.autoCreateIndex = autoCreateIndex;
105        }
106
107        public String getUserName() {
108                return this.userName;
109        }
110
111        public void setUserName(String userName) {
112                this.userName = userName;
113        }
114
115        public String getPassword() {
116                return this.password;
117        }
118
119        public void setPassword(String password) {
120                this.password = password;
121        }
122
123}