All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web-interface.assets.325e2d4b-1442.e2649d24a0a94d2d487f.js Maven / Gradle / Ivy

There is a newer version: 6.0.2
Show newest version
"use strict";(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["325e2d4b-1442"],{kSWYIN6i:(e,t,r)=>{r.r(t),r.d(t,{default:()=>B});var n=r("D4SbLiE/"),o=r.n(n),s=r("ii0bleBb"),a=r.n(s),i=r("Z7aTuO5B"),l=r("JnTtTRmZ"),c=r.n(l),m=r("EeAwn/0x"),d=r("0zTRKSqx"),u=r("j/+1GA3k"),p=r("F9olzlTR"),h=r("8pZttqbT"),E=r("6MN7/oMt"),x=r("QQNFCPWy");function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class f extends i.Component{constructor(e){super(e),g(this,"_showAddExtractorForm",(()=>{this.setState((e=>{let{showExtractorForm:t}=e;return{showExtractorForm:!t}}))})),this.state={showExtractorForm:!1}}render(){let e;if(this.state.showExtractorForm){const t=i.createElement(x.Z,{fieldName:"",message:{}});e=i.createElement("div",{className:"stream-loader"},i.createElement(E.Z,{selectedInputId:this.props.inputId,customFieldActions:t}))}return i.createElement(p.X2,{className:"content"},i.createElement(p.JX,{md:12},i.createElement("h2",{style:{marginBottom:5}},"Add extractor"),i.createElement("p",null,"Start by loading a message to have an example to work on. You can decide whether to load a recent message received by this input, or manually select a message giving its ID."),i.createElement("p",null,i.createElement(p.zx,{bsStyle:"success",bsSize:"small",onClick:this._showAddExtractorForm,disabled:this.state.showExtractorForm},"Create extractor")),e))}}g(f,"propTypes",{inputId:a().string}),g(f,"defaultProps",{inputId:void 0});const y=f;var _=r("8/qN0F2n"),v=r("OjsYU8Qj"),b=r("9pdI12pI"),C=r.n(b),S=r("06iixBf9"),w=r("6KAdqMq6"),Z=r("DeVaSktS");function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const P=e=>{let{timing:t}=e;return i.createElement("dl",{className:"metric-def metric-timer"},i.createElement("dt",null,"95th percentile:"),i.createElement("dd",null,C()(t["95th_percentile"]).format("0,0.[00]"),"μs"),i.createElement("dt",null,"98th percentile:"),i.createElement("dd",null,C()(t["98th_percentile"]).format("0,0.[00]"),"μs"),i.createElement("dt",null,"99th percentile:"),i.createElement("dd",null,C()(t["99th_percentile"]).format("0,0.[00]"),"μs"),i.createElement("dt",null,"Standard deviation:"),i.createElement("dd",null,C()(t.std_dev).format("0,0.[00]"),"μs"),i.createElement("dt",null,"Mean:"),i.createElement("dd",null,C()(t.mean).format("0,0.[00]"),"μs"),i.createElement("dt",null,"Minimum:"),i.createElement("dd",null,C()(t.min).format("0,0.[00]"),"μs"),i.createElement("dt",null,"Maximum:"),i.createElement("dd",null,C()(t.max).format("0,0.[00]"),"μs"))};P.propTypes={timing:a().object.isRequired};const I=e=>{let t,{metrics:r}=e;r.total.rate&&(t=i.createElement("div",{className:"meter",style:{marginBottom:10}},C()(r.total.rate.total).format("0,0")," total invocations since boot,"," ","averages:"," ",C()(r.total.rate.one_minute).format("0,0.[00]"),","," ",C()(r.total.rate.five_minute).format("0,0.[00]"),","," ",C()(r.total.rate.fifteen_minute).format("0,0.[00]"),"."));const n=i.createElement("div",{className:"meter",style:{marginBottom:10}},r.condition_hits," hits,"," ",r.condition_misses," misses");let o,s,a,l;return o=r.total.time?i.createElement(P,{timing:r.total.time}):"No message passed through here yet.",s=r.condition.time?i.createElement(P,{timing:r.condition.time}):"No message passed through here yet.",a=r.execution.time?i.createElement(P,{timing:r.execution.time}):"No message passed through here yet.",l=r.converters.time?i.createElement(P,{timing:r.converters.time}):"No message passed through here yet.",i.createElement("div",null,t,n,i.createElement(p.X2,null,i.createElement(p.JX,{md:6},i.createElement("h4",{style:{display:"inline"}},"Total time"),i.createElement("br",null),o),i.createElement(p.JX,{md:6},i.createElement("h4",{style:{display:"inline"}},"Condition time"),i.createElement("br",null),s),i.createElement(p.JX,{md:6},i.createElement("h4",{style:{display:"inline"}},"Execution time"),i.createElement("br",null),a),i.createElement(p.JX,{md:6},i.createElement("h4",{style:{display:"inline"}},"Converter time"),i.createElement("br",null),l)))};I.propTypes={metrics:a().object.isRequired};class N extends i.Component{constructor(e){super(e),T(this,"_toggleDetails",(()=>{const{showDetails:e}=this.state;this.setState({showDetails:!e})})),T(this,"_deleteExtractor",(()=>{const{extractor:e,inputId:t}=this.props;window.confirm(`Really remove extractor "${e.title}?"`)&&v.e.delete.triggerPromise(t,e)})),T(this,"_formatExtractorSubtitle",(()=>{const{extractor:e}=this.props;return i.createElement("span",null,"Trying to extract data from ",i.createElement("em",null,e.source_field)," into"," ",i.createElement("em",null,e.target_field),","," ","cut"===e.cursor_strategy&&"not"," ","leaving the original intact.")})),T(this,"_formatCondition",(()=>{const{extractor:e}=this.props;return"none"===e.condition_type?i.createElement("div",null):i.createElement("div",{className:"configuration-section"},i.createElement("h4",null,"Condition"),i.createElement("ul",null,i.createElement("li",null,"Will only attempt to run if the message"," ","string"===e.condition_type?"includes the string":"matches the regular expression"," ",i.createElement("em",null,e.condition_value))))})),T(this,"_formatActions",(()=>{const e=[],{extractor:t,nodeId:r,inputId:n}=this.props;return e.push(i.createElement(p.zx,{key:`extractor-details-${t.id}`,bsStyle:"info",onClick:this._toggleDetails},"Details")),e.push(i.createElement(m.J,{key:`edit-extractor-${t.id}`,to:Z.ZP.edit_input_extractor(r,n,t.id)},i.createElement(p.zx,null,"Edit"))),e.push(i.createElement(p.zx,{key:"delete-extractor-",bsStyle:"danger",onClick:this._deleteExtractor},"Delete")),e})),T(this,"_formatOptions",(e=>{const{extractor:t}=this.props;return Object.keys(e).map((r=>i.createElement("li",{key:`${r}-${t.id}`},r,": ",e[r])))})),T(this,"_formatConfiguration",(e=>{let t=this._formatOptions(e);return 0===t.length&&(t=i.createElement("li",null,"No configuration options")),i.createElement("div",{className:"configuration-section"},i.createElement("h4",null,"Configuration"),i.createElement("ul",null,t))})),T(this,"_formatConverter",((e,t)=>i.createElement("li",{key:`converter-${e}`},t.type,t.config&&i.createElement("ul",null,this._formatOptions(t.config))))),T(this,"_formatConverters",(e=>{const t=Object.keys(e).map((t=>this._formatConverter(t,e[t])));return 0===t.length?i.createElement("div",null):i.createElement("div",{className:"configuration-section"},i.createElement("h4",null,"Converters"),i.createElement("ul",null,t))})),T(this,"_formatDetails",(()=>{const{extractor:e}=this.props;return i.createElement("div",null,i.createElement(p.JX,{md:8},i.createElement(p.tW,{bsSize:"small",className:"configuration-well"},this._formatCondition(),this._formatConfiguration(e.extractor_config),this._formatConverters(e.converters))),i.createElement(p.JX,{md:4},i.createElement("div",{className:"graylog-input-metrics"},i.createElement("h3",null,"Metrics"),i.createElement(I,{metrics:e.metrics}))))})),this.state={showDetails:!1}}render(){const{extractor:e}=this.props,{showDetails:t}=this.state;return i.createElement(S.Z,{key:`entry-list-${e.id}`,title:e.title,titleSuffix:w.Z.getReadableExtractorTypeName(e.type),description:this._formatExtractorSubtitle(),actions:this._formatActions(),contentRow:t?this._formatDetails():null})}}T(N,"propTypes",{extractor:a().object.isRequired,inputId:a().string.isRequired,nodeId:a().string.isRequired});const R=N;var D=r("pB1wajvK");function k(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class j extends i.Component{constructor(e){super(e),k(this,"_cancel",(()=>{const{extractors:e,onClose:t}=this.props;t(),this.setState({sortedExtractors:e})})),k(this,"_updateSorting",(e=>{this.setState({sortedExtractors:e})})),k(this,"_saveSorting",(async()=>{const{input:e,onClose:t,onSort:r}=this.props,{sortedExtractors:n}=this.state;n||t(),await v.e.order.triggerPromise(e.id,n),r(),t()})),this.state={sortedExtractors:e.extractors}}render(){const{sortedExtractors:e}=this.state,{input:t}=this.props;return i.createElement(p.uD,{showModal:!0,onHide:this._cancel},i.createElement(p.u_.Header,{closeButton:!0},i.createElement(p.u_.Title,null,i.createElement("span",null,"Sort extractors for ",i.createElement("em",null,t.title)))),i.createElement(p.u_.Body,null,i.createElement("p",null,"Drag and drop the extractors on the list to change the order in which they will be applied."),i.createElement(p.X2,{className:"row-sm"},i.createElement(p.JX,{md:12},i.createElement(D.Z,{items:e,onMoveItem:this._updateSorting,displayOverlayInPortal:!0})))),i.createElement(p.u_.Footer,null,i.createElement(d.os,{onCancel:this._cancel,onSubmit:this._saveSorting,submitButtonText:"Update sort"})))}}k(j,"propTypes",{input:a().object.isRequired,extractors:a().array.isRequired,onClose:a().func.isRequired,onSort:a().func.isRequired});const q=j,J=(e,t)=>{v.e.list.triggerPromise(e).then((e=>t(null==e?void 0:e.extractors)))},O=e=>{let{input:t,node:r}=e;const[n,o]=(0,i.useState)(null),[s,a]=(0,i.useState)(!1);(0,i.useEffect)((()=>{J(t.id,o)}),[t.id]);const l=()=>{a(!0)};let c;(null==n?void 0:n.length)>1&&(c=i.createElement(p.zx,{bsSize:"xsmall",bsStyle:"primary",className:"pull-right",onClick:l},"Sort extractors"));const m=null==n?void 0:n.sort(((e,t)=>e.order-t.order)).map((e=>i.createElement(R,{key:e.id,extractor:e,inputId:t.id,nodeId:r.node_id})));return n?i.createElement("div",null,i.createElement(y,{inputId:t.id}),i.createElement(p.X2,{className:"content extractor-list"},i.createElement(p.JX,{md:12},i.createElement(p.X2,{className:"row-sm"},i.createElement(p.JX,{md:8},i.createElement("h2",null,"Configured extractors")),i.createElement(p.JX,{md:4},c)),i.createElement(_.Z,{bsNoItemsStyle:"info",noItemsText:"This input has no configured extractors.",items:m}))),s&&i.createElement(q,{input:t,extractors:n,onClose:()=>a(!1),onSort:()=>J(t.id,o)})):i.createElement(h.Z,null)};O.propTypes={input:a().object.isRequired,node:a().object.isRequired};const X=O;var A=r("4Js8dUPg"),F=r("CfS4XPvw"),M=r("JNjM1tjZ"),U=r("b3xCUZUh");const z=o()({displayName:"ExtractorsPage",propTypes:{params:a().object.isRequired},mixins:[c().listenTo(U.S,"onNodesChange")],getInitialState:()=>({node:void 0}),componentDidMount(){const{params:e}=this.props;M.x.get(e.inputId).then((e=>this.setState({input:e}))),U.h.list()},onNodesChange(e){const{params:t}=this.props,r=t.nodeId?e.nodes[t.nodeId]:Object.values(e.nodes).filter((e=>e.is_leader))[0],{node:n}=this.state;n&&n.node_id===r.node_id||this.setState({node:r})},_isLoading(){const{node:e,input:t}=this.state;return!(t&&e)},render(){if(this._isLoading())return i.createElement(d.$j,null);const{node:e,input:t}=this.state;return i.createElement(d.$4,{title:`Extractors of ${t.title}`},i.createElement("div",null,i.createElement(u.Z,{title:i.createElement("span",null,"Extractors of ",i.createElement("em",null,t.title)),actions:i.createElement(p.PS,{bsStyle:"info",id:"extractor-actions-dropdown",title:"Actions",pullRight:!0},i.createElement(m.J,{to:Z.ZP.import_extractors(e.node_id,t.id)},i.createElement(p.sN,null,"Import extractors")),i.createElement(m.J,{to:Z.ZP.export_extractors(e.node_id,t.id)},i.createElement(p.sN,null,"Export extractors"))),documentationLink:{title:"Extractors documentation",path:A.Z.PAGES.EXTRACTORS}},i.createElement("span",null,"Extractors are applied on every message that is received by this input. Use them to extract and transform"," ","any text data into fields that allow you easy filtering and analysis later on."," ","Example: Extract the HTTP response code from a log message, transform it to a numeric field and attach it"," ","as ",i.createElement("em",null,"http_response_code")," to the message.")),i.createElement(X,{input:t,node:e})))}}),B=(0,F.Z)(z)},OjsYU8Qj:(e,t,r)=>{r.d(t,{F:()=>E,e:()=>p});var n=r("JnTtTRmZ"),o=r.n(n),s=r("YPyIcTeH"),a=r.n(s),i=r("rkoyttmq"),l=r("OqsMdpSm"),c=r("6KAdqMq6"),m=r("0wQfx7YJ"),d=r("4af3+9mh"),u=r("xc00RsLr");const p=(0,u.ei)("core.Extractors",(()=>o().createActions({list:{asyncResult:!0},get:{asyncResult:!0},create:{asyncResult:!0},save:{asyncResult:!0},update:{asyncResult:!0},delete:{asyncResult:!0},order:{asyncResult:!0},import:{}})));function h(e){const t=e.condition_type&&"none"!==e.condition_type?e.condition_value:"";return{title:e.title,cursor_strategy:e.cursor_strategy||"copy",source_field:e.source_field,target_field:e.target_field,extractor_type:e.type||e.extractor_type,extractor_config:e.extractor_config,converters:e.converters,condition_type:e.condition_type||"none",condition_value:t,order:e.order}}const E=(0,u.dS)("core.Extractors",(()=>o().createStore({listenables:[p],sourceUrl:"/system/inputs/",extractors:void 0,extractor:void 0,init(){this.trigger({extractors:this.extractors,extractor:this.extractor})},list(e){const t=(0,l.ZP)("GET",m.DC(m.em(this.sourceUrl,e,"extractors")));t.then((e=>{this.extractors=e.extractors,this.trigger({extractors:this.extractors})})),p.list.promise(t)},new(e,t){if(-1===c.Z.EXTRACTOR_TYPES.indexOf(e))throw new Error(`Invalid extractor type provided: ${e}`);return{type:e,source_field:t,converters:[],extractor_config:{},target_field:""}},get(e,t){const r=(0,l.ZP)("GET",m.DC(m.em(this.sourceUrl,e,"extractors",t)));r.then((e=>{this.extractor=e,this.trigger({extractor:this.extractor})})),p.get.promise(r)},save(e,t){let r;r=t.id?this.update(e,t,!0):this.create(e,t,!0),p.save.promise(r)},_silentExtractorCreate(e,t){const r=m.DC(i.Z.ExtractorsController.create(e).url);return(0,l.ZP)("POST",r,h(t))},create(e,t,r){const n=this._silentExtractorCreate(e,t);return n.then((()=>{d.Z.success(`Extractor ${t.title} created successfully`),this.extractor&&p.get.triggerPromise(e,t.id)})).catch((e=>{d.Z.error(`Creating extractor failed: ${e}`,"Could not create extractor")})),r||p.create.promise(n),n},update(e,t,r){const n=m.DC(i.Z.ExtractorsController.update(e,t.id).url),o=(0,l.ZP)("PUT",n,h(t));return o.then((()=>{d.Z.success(`Extractor "${t.title}" updated successfully`),this.extractor&&p.get.triggerPromise(e,t.id)})).catch((e=>{d.Z.error(`Updating extractor failed: ${e}`,"Could not update extractor")})),r||p.update.promise(o),o},delete(e,t){const r=m.DC(i.Z.ExtractorsController.delete(e,t.id).url),n=(0,l.ZP)("DELETE",r);n.then((()=>{d.Z.success(`Extractor "${t.title}" deleted successfully`),this.extractors&&p.list.triggerPromise(e)})).catch((e=>{d.Z.error(`Deleting extractor failed: ${e}`,`Could not delete extractor ${t.title}`)})),p.delete.promise(n)},order(e,t){const r=m.DC(i.Z.ExtractorsController.order(e).url),n={};t.forEach(((e,t)=>{n[t]=e.id}));const o=(0,l.ZP)("POST",r,{order:n});o.then((()=>{d.Z.success("Extractor positions updated successfully"),this.extractors&&p.list.triggerPromise(e)})),o.catch((e=>{d.Z.error(`Changing extractor positions failed: ${e}`,"Could not update extractor positions")})),p.order.promise(o)},import(e,t){let r=0,n=0;const o=[];t.forEach((t=>{const s=this._silentExtractorCreate(e,t);s.then((()=>{r+=1})).catch((()=>{n+=1})),o.push(s)})),a().settle(o).then((()=>{0===n?d.Z.success(`Import results: ${r} extractor(s) imported.`,"Import operation successful"):d.Z.warning(`Import results: ${r} extractor(s) imported, ${n} error(s).`,"Import operation completed")}))}})))}}]);
//# sourceMappingURL=325e2d4b-1442.e2649d24a0a94d2d487f.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy