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

web-interface.assets.1255d548-6800.29ab0d5405adc761e098.js Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
"use strict";(()=>{(self.webpackChunkgraylog_web_interface=self.webpackChunkgraylog_web_interface||[]).push([["1255d548-6800"],{"+U5Unhmb":(N,S,s)=>{s.r(S),s.d(S,{default:()=>nt});var M=s("D4SbLiE/"),T=s.n(M),P=s("ii0bleBb"),d=s.n(P),t=s("Z7aTuO5B"),x=s("JnTtTRmZ"),f=s.n(x),R=s("ty2gyrHp"),E=s("/GOzvPf6"),O=s("/W/x1zfW"),l=s("uZqmR+ju"),n=s("dsvqAVKU"),a=s("mihjYJ2+"),c=s("8/L0uEJc"),m=Object.defineProperty,h=(r,o,e)=>o in r?m(r,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[o]=e,g=(r,o,e)=>(h(r,typeof o!="symbol"?o+"":o,e),e);class C extends t.Component{constructor(o){super(o),g(this,"_showAddExtractorForm",()=>{this.setState(({showExtractorForm:e})=>({showExtractorForm:!e}))}),this.state={showExtractorForm:!1}}render(){let o;if(this.state.showExtractorForm){const e=t.createElement(c.Z,{fieldName:"",message:{}});o=t.createElement("div",{className:"stream-loader"},t.createElement(a.Z,{selectedInputId:this.props.inputId,customFieldActions:e}))}return t.createElement(l.Row,{className:"content"},t.createElement(l.Col,{md:12},t.createElement("h2",{style:{marginBottom:5}},"Add extractor"),t.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."),t.createElement("p",null,t.createElement(l.Button,{bsStyle:"success",bsSize:"small",onClick:this._showAddExtractorForm,disabled:this.state.showExtractorForm},"Create extractor")),o))}}g(C,"propTypes",{inputId:d().string}),g(C,"defaultProps",{inputId:void 0});const w=C;var J=s("gn61rwrR"),B=s("8UzJguce"),j=s("9pdI12pI"),v=s.n(j),z=s("KDUSw0C6"),H=s("xS8q27Jr"),A=s("d4kzUuQm"),G=Object.defineProperty,Y=(r,o,e)=>o in r?G(r,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[o]=e,y=(r,o,e)=>(Y(r,typeof o!="symbol"?o+"":o,e),e);const D=({timing:r})=>t.createElement("dl",{className:"metric-def metric-timer"},t.createElement("dt",null,"95th percentile:"),t.createElement("dd",null,v()(r["95th_percentile"]).format("0,0.[00]"),"\u03BCs"),t.createElement("dt",null,"98th percentile:"),t.createElement("dd",null,v()(r["98th_percentile"]).format("0,0.[00]"),"\u03BCs"),t.createElement("dt",null,"99th percentile:"),t.createElement("dd",null,v()(r["99th_percentile"]).format("0,0.[00]"),"\u03BCs"),t.createElement("dt",null,"Standard deviation:"),t.createElement("dd",null,v()(r.std_dev).format("0,0.[00]"),"\u03BCs"),t.createElement("dt",null,"Mean:"),t.createElement("dd",null,v()(r.mean).format("0,0.[00]"),"\u03BCs"),t.createElement("dt",null,"Minimum:"),t.createElement("dd",null,v()(r.min).format("0,0.[00]"),"\u03BCs"),t.createElement("dt",null,"Maximum:"),t.createElement("dd",null,v()(r.max).format("0,0.[00]"),"\u03BCs"));D.propTypes={timing:d().object.isRequired};const U=({metrics:r})=>{let o;r.total.rate&&(o=t.createElement("div",{className:"meter",style:{marginBottom:10}},v()(r.total.rate.total).format("0,0")," total invocations since boot,"," ","averages:"," ",v()(r.total.rate.one_minute).format("0,0.[00]"),","," ",v()(r.total.rate.five_minute).format("0,0.[00]"),","," ",v()(r.total.rate.fifteen_minute).format("0,0.[00]"),"."));const e=t.createElement("div",{className:"meter",style:{marginBottom:10}},r.condition_hits," hits,"," ",r.condition_misses," misses");let i;r.total.time?i=t.createElement(D,{timing:r.total.time}):i="No message passed through here yet.";let p;r.condition.time?p=t.createElement(D,{timing:r.condition.time}):p="No message passed through here yet.";let u;r.execution.time?u=t.createElement(D,{timing:r.execution.time}):u="No message passed through here yet.";let I;return r.converters.time?I=t.createElement(D,{timing:r.converters.time}):I="No message passed through here yet.",t.createElement("div",null,o,e,t.createElement(l.Row,null,t.createElement(l.Col,{md:6},t.createElement("h4",{style:{display:"inline"}},"Total time"),t.createElement("br",null),i),t.createElement(l.Col,{md:6},t.createElement("h4",{style:{display:"inline"}},"Condition time"),t.createElement("br",null),p),t.createElement(l.Col,{md:6},t.createElement("h4",{style:{display:"inline"}},"Execution time"),t.createElement("br",null),u),t.createElement(l.Col,{md:6},t.createElement("h4",{style:{display:"inline"}},"Converter time"),t.createElement("br",null),I)))};U.propTypes={metrics:d().object.isRequired};class L extends t.Component{constructor(o){super(o),y(this,"_toggleDetails",()=>{const{showDetails:e}=this.state;this.setState({showDetails:!e})}),y(this,"_deleteExtractor",()=>{const{extractor:e,inputId:i}=this.props;window.confirm(`Really remove extractor "${e.title}?"`)&&B.e.delete.triggerPromise(i,e)}),y(this,"_formatExtractorSubtitle",()=>{const{extractor:e}=this.props;return t.createElement("span",null,"Trying to extract data from ",t.createElement("em",null,e.source_field)," into"," ",t.createElement("em",null,e.target_field),","," ",e.cursor_strategy==="cut"&&"not"," ","leaving the original intact.")}),y(this,"_formatCondition",()=>{const{extractor:e}=this.props;return e.condition_type==="none"?t.createElement("div",null):t.createElement("div",{className:"configuration-section"},t.createElement("h4",null,"Condition"),t.createElement("ul",null,t.createElement("li",null,"Will only attempt to run if the message"," ",e.condition_type==="string"?"includes the string":"matches the regular expression"," ",t.createElement("em",null,e.condition_value))))}),y(this,"_formatActions",()=>{const e=[],{extractor:i,nodeId:p,inputId:u}=this.props;return e.push(t.createElement(l.Button,{key:`extractor-details-${i.id}`,bsStyle:"info",onClick:this._toggleDetails},"Details")),e.push(t.createElement(R.J,{key:`edit-extractor-${i.id}`,to:A.ZP.edit_input_extractor(p,u,i.id)},t.createElement(l.Button,null,"Edit"))),e.push(t.createElement(l.Button,{key:"delete-extractor-",bsStyle:"danger",onClick:this._deleteExtractor},"Delete")),e}),y(this,"_formatOptions",e=>{const{extractor:i}=this.props;return Object.keys(e).map(u=>t.createElement("li",{key:`${u}-${i.id}`},u,": ",e[u]))}),y(this,"_formatConfiguration",e=>{let i=this._formatOptions(e);return i.length===0&&(i=t.createElement("li",null,"No configuration options")),t.createElement("div",{className:"configuration-section"},t.createElement("h4",null,"Configuration"),t.createElement("ul",null,i))}),y(this,"_formatConverter",(e,i)=>t.createElement("li",{key:`converter-${e}`},i.type,i.config&&t.createElement("ul",null,this._formatOptions(i.config)))),y(this,"_formatConverters",e=>{const p=Object.keys(e).map(u=>this._formatConverter(u,e[u]));return p.length===0?t.createElement("div",null):t.createElement("div",{className:"configuration-section"},t.createElement("h4",null,"Converters"),t.createElement("ul",null,p))}),y(this,"_formatDetails",()=>{const{extractor:e}=this.props;return t.createElement("div",null,t.createElement(l.Col,{md:8},t.createElement(l.Well,{bsSize:"small",className:"configuration-well"},this._formatCondition(),this._formatConfiguration(e.extractor_config),this._formatConverters(e.converters))),t.createElement(l.Col,{md:4},t.createElement("div",{className:"graylog-input-metrics"},t.createElement("h3",null,"Metrics"),t.createElement(U,{metrics:e.metrics}))))}),this.state={showDetails:!1}}render(){const{extractor:o}=this.props,{showDetails:e}=this.state;return t.createElement(z.Z,{key:`entry-list-${o.id}`,title:o.title,titleSuffix:H.Z.getReadableExtractorTypeName(o.type),description:this._formatExtractorSubtitle(),actions:this._formatActions(),contentRow:e?this._formatDetails():null})}}y(L,"propTypes",{extractor:d().object.isRequired,inputId:d().string.isRequired,nodeId:d().string.isRequired});const X=L;var Q=s("K/dyB2Jn"),V=Object.defineProperty,q=(r,o,e)=>o in r?V(r,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[o]=e,Z=(r,o,e)=>(q(r,typeof o!="symbol"?o+"":o,e),e);class b extends t.Component{constructor(o){super(o),Z(this,"_cancel",()=>{const{extractors:e,onClose:i}=this.props;i(),this.setState({sortedExtractors:e})}),Z(this,"_updateSorting",e=>{this.setState({sortedExtractors:e})}),Z(this,"_saveSorting",async()=>{const{input:e,onClose:i,onSort:p}=this.props,{sortedExtractors:u}=this.state;u||i(),await B.e.order.triggerPromise(e.id,u),p(),i()}),this.state={sortedExtractors:o.extractors}}render(){const{sortedExtractors:o}=this.state,{input:e}=this.props;return t.createElement(l.BootstrapModalWrapper,{showModal:!0,onHide:this._cancel},t.createElement(l.Modal.Header,{closeButton:!0},t.createElement(l.Modal.Title,null,t.createElement("span",null,"Sort extractors for ",t.createElement("em",null,e.title)))),t.createElement(l.Modal.Body,null,t.createElement("p",null,"Drag and drop the extractors on the list to change the order in which they will be applied."),t.createElement(l.Row,{className:"row-sm"},t.createElement(l.Col,{md:12},t.createElement(Q.Z,{items:o,onMoveItem:this._updateSorting,displayOverlayInPortal:!0})))),t.createElement(l.Modal.Footer,null,t.createElement(E.os,{onCancel:this._cancel,onSubmit:this._saveSorting,submitButtonText:"Update sort"})))}}Z(b,"propTypes",{input:d().object.isRequired,extractors:d().array.isRequired,onClose:d().func.isRequired,onSort:d().func.isRequired});const k=b,$=(r,o)=>{B.e.list.triggerPromise(r).then(e=>o(e==null?void 0:e.extractors))},F=({input:r,node:o})=>{const[e,i]=(0,t.useState)(null),[p,u]=(0,t.useState)(!1);(0,t.useEffect)(()=>{$(r.id,i)},[r.id]);const I=_=>t.createElement(X,{key:_.id,extractor:_,inputId:r.id,nodeId:o.node_id}),at=()=>!e,lt=()=>{u(!0)};let K;(e==null?void 0:e.length)>1&&(K=t.createElement(l.Button,{bsSize:"xsmall",bsStyle:"primary",className:"pull-right",onClick:lt},"Sort extractors"));const it=e==null?void 0:e.sort((_,ct)=>_.order-ct.order).map(I);return at()?t.createElement(n.Z,null):t.createElement("div",null,t.createElement(w,{inputId:r.id}),t.createElement(l.Row,{className:"content extractor-list"},t.createElement(l.Col,{md:12},t.createElement(l.Row,{className:"row-sm"},t.createElement(l.Col,{md:8},t.createElement("h2",null,"Configured extractors")),t.createElement(l.Col,{md:4},K)),t.createElement(J.Z,{bsNoItemsStyle:"info",noItemsText:"This input has no configured extractors.",items:it}))),p&&t.createElement(k,{input:r,extractors:e,onClose:()=>u(!1),onSort:()=>$(r.id,i)}))};F.propTypes={input:d().object.isRequired,node:d().object.isRequired};const tt=F;var et=s("E+CaPsQD"),rt=s("c9JM82dZ"),ot=s("yEuO7gC5"),W=s("Vg8s2y9S");const st=T()({displayName:"ExtractorsPage",propTypes:{params:d().object.isRequired},mixins:[f().listenTo(W.S,"onNodesChange")],getInitialState(){return{node:void 0}},componentDidMount(){const{params:r}=this.props;ot.x.get(r.inputId).then(o=>this.setState({input:o})),W.h.list()},onNodesChange(r){const{params:o}=this.props,e=o.nodeId?r.nodes[o.nodeId]:Object.values(r.nodes).filter(p=>p.is_leader)[0],{node:i}=this.state;(!i||i.node_id!==e.node_id)&&this.setState({node:e})},_isLoading(){const{node:r,input:o}=this.state;return!(o&&r)},render(){if(this._isLoading())return t.createElement(E.$j,null);const{node:r,input:o}=this.state;return t.createElement(E.$4,{title:`Extractors of ${o.title}`},t.createElement("div",null,t.createElement(O.Z,{title:t.createElement("span",null,"Extractors of ",t.createElement("em",null,o.title)),actions:t.createElement(l.DropdownButton,{bsStyle:"info",id:"extractor-actions-dropdown",title:"Actions",pullRight:!0},t.createElement(R.J,{to:A.ZP.import_extractors(r.node_id,o.id)},t.createElement(l.MenuItem,null,"Import extractors")),t.createElement(R.J,{to:A.ZP.export_extractors(r.node_id,o.id)},t.createElement(l.MenuItem,null,"Export extractors"))),documentationLink:{title:"Extractors documentation",path:et.Z.PAGES.EXTRACTORS}},t.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 ",t.createElement("em",null,"http_response_code")," to the message.")),t.createElement(tt,{input:o,node:r})))}}),nt=(0,rt.Z)(st)},c9JM82dZ:(N,S,s)=>{s.d(S,{Z:()=>d});var M=s("Z7aTuO5B"),T=s("yAXMqwrl");const d=t=>x=>{const f=(0,T.useParams)();return M.createElement(t,{...x,params:f})}},"8UzJguce":(N,S,s)=>{s.d(S,{F:()=>l,e:()=>E});var M=s("JnTtTRmZ"),T=s.n(M),P=s("U1Iufsob"),d=s("eFxcQyPT"),t=s("xS8q27Jr"),x=s("MdYBRjRJ"),f=s("jAGDuYSC"),R=s("IA3Ku5lS");const E=(0,R.ei)("core.Extractors",()=>T().createActions({list:{asyncResult:!0},get:{asyncResult:!0},create:{asyncResult:!0},save:{asyncResult:!0},update:{asyncResult:!0},delete:{asyncResult:!0},order:{asyncResult:!0},import:{}}));function O(n){const a=n.condition_type&&n.condition_type!=="none"?n.condition_value:"";return{title:n.title,cursor_strategy:n.cursor_strategy||"copy",source_field:n.source_field,target_field:n.target_field,extractor_type:n.type||n.extractor_type,extractor_config:n.extractor_config,converters:n.converters,condition_type:n.condition_type||"none",condition_value:a,order:n.order}}const l=(0,R.dS)("core.Extractors",()=>T().createStore({listenables:[E],sourceUrl:"/system/inputs/",extractors:void 0,extractor:void 0,init(){this.trigger({extractors:this.extractors,extractor:this.extractor})},list(n){const a=(0,d.ZP)("GET",x.DC(x.em(this.sourceUrl,n,"extractors")));a.then(c=>{this.extractors=c.extractors,this.trigger({extractors:this.extractors})}),E.list.promise(a)},new(n,a){if(t.Z.EXTRACTOR_TYPES.indexOf(n)===-1)throw new Error(`Invalid extractor type provided: ${n}`);return{type:n,source_field:a,converters:[],extractor_config:{},target_field:""}},get(n,a){const c=(0,d.ZP)("GET",x.DC(x.em(this.sourceUrl,n,"extractors",a)));c.then(m=>{this.extractor=m,this.trigger({extractor:this.extractor})}),E.get.promise(c)},save(n,a){let c;a.id?c=this.update(n,a,!0):c=this.create(n,a,!0),E.save.promise(c)},_silentExtractorCreate(n,a){const c=x.DC(P.Z.ExtractorsController.create(n).url);return(0,d.ZP)("POST",c,O(a))},create(n,a,c){const m=this._silentExtractorCreate(n,a);return m.then(()=>{f.Z.success(`Extractor ${a.title} created successfully`),this.extractor&&E.get.triggerPromise(n,a.id)}).catch(h=>{f.Z.error(`Creating extractor failed: ${h}`,"Could not create extractor")}),c||E.create.promise(m),m},update(n,a,c){const m=x.DC(P.Z.ExtractorsController.update(n,a.id).url),h=(0,d.ZP)("PUT",m,O(a));return h.then(()=>{f.Z.success(`Extractor "${a.title}" updated successfully`),this.extractor&&E.get.triggerPromise(n,a.id)}).catch(g=>{f.Z.error(`Updating extractor failed: ${g}`,"Could not update extractor")}),c||E.update.promise(h),h},delete(n,a){const c=x.DC(P.Z.ExtractorsController.delete(n,a.id).url),m=(0,d.ZP)("DELETE",c);m.then(()=>{f.Z.success(`Extractor "${a.title}" deleted successfully`),this.extractors&&E.list.triggerPromise(n)}).catch(h=>{f.Z.error(`Deleting extractor failed: ${h}`,`Could not delete extractor ${a.title}`)}),E.delete.promise(m)},order(n,a){const c=x.DC(P.Z.ExtractorsController.order(n).url),m={};a.forEach((g,C)=>{m[C]=g.id});const h=(0,d.ZP)("POST",c,{order:m});h.then(()=>{f.Z.success("Extractor positions updated successfully"),this.extractors&&E.list.triggerPromise(n)}),h.catch(g=>{f.Z.error(`Changing extractor positions failed: ${g}`,"Could not update extractor positions")}),E.order.promise(h)},import(n,a){let c=0,m=0;const h=[];a.forEach(g=>{const C=this._silentExtractorCreate(n,g);C.then(()=>{c+=1}).catch(()=>{m+=1}),h.push(C)}),Promise.allSettled(h).then(()=>{m===0?f.Z.success(`Import results: ${c} extractor(s) imported.`,"Import operation successful"):f.Z.warning(`Import results: ${c} extractor(s) imported, ${m} error(s).`,"Import operation completed")})}}))}}]);})();

//# sourceMappingURL=1255d548-6800.29ab0d5405adc761e098.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy