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

web-interface.assets.bb8c8232-4168.e6772911027ec5fb5c5d.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([["bb8c8232-4168"],{WXKdeTMX:(K,O,r)=>{r.d(O,{A:()=>d});var e=r("pmX897Fv"),D=r.n(e),s=r("DjJvgDaP"),C=r.n(s),E=C()(D());E.push([K.id,`.YdarIKpxaNitFlWJ678S {
    height: 160px;
    max-height: 160px;
    overflow: hidden;
    overflow-y: scroll;
    padding-left: 0;
    border-bottom: 1px solid #ddd;
}

.kqwpZ3NGYl1tRenAeuma {
    margin-bottom: 0px;
}

.lmEVMuAgMnJwEQOO5HRZ {
    position: absolute;
    top: 7px;
    right: 7px;
}

.J36QQw1MHcjMFdoQeCi9 {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    display: block;
}
`,"",{version:3,sources:["webpack://./src/components/grok-patterns/GrokPatternFilter.css"],names:[],mappings:"AAAA;IACI,aAAa;IACb,iBAAiB;IACjB,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,6BAA6B;AACjC;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;IAClB,QAAQ;IACR,UAAU;AACd;;AAEA;IACI,uBAAuB;IACvB,mBAAmB;IACnB,gBAAgB;IAChB,cAAc;AAClB",sourcesContent:[`:local(.resultList) {
    height: 160px;
    max-height: 160px;
    overflow: hidden;
    overflow-y: scroll;
    padding-left: 0;
    border-bottom: 1px solid #ddd;
}

:local(.filterFormGroup) {
    margin-bottom: 0px;
}

:local(.addButton) {
    position: absolute;
    top: 7px;
    right: 7px;
}

:local(.patternDisplay) {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    display: block;
}
`],sourceRoot:""}]),E.locals={resultList:"YdarIKpxaNitFlWJ678S",filterFormGroup:"kqwpZ3NGYl1tRenAeuma",addButton:"lmEVMuAgMnJwEQOO5HRZ",patternDisplay:"J36QQw1MHcjMFdoQeCi9"};const d=E},"5chL1ePP":(K,O,r)=>{r.d(O,{A:()=>Y});var e=r("ii0bleBb"),D=r.n(e),s=r("Z7aTuO5B"),C=r("rIl5IEuP"),E=r("+KM7MH1U"),d=r.n(E),T=r("dFpwyWHg"),G=r.n(T),w=r("C2ikvoS0"),p=r.n(w),v=r("1IntWRSu"),i=r.n(v),g=r("8nGWeFnd"),h=r.n(g),u=r("TeAcaicX"),y=r.n(u),f=r("eE3+5goe"),_=r.n(f),L=r("WXKdeTMX"),b={};b.styleTagTransform=_(),b.setAttributes=h(),b.insert=i().bind(null,"head"),b.domAPI=p(),b.insertStyleElement=y();var W=G()(L.A,b);const N=L.A&&L.A.locals?L.A.locals:void 0;var Q=Object.defineProperty,H=(A,m,o)=>m in A?Q(A,m,{enumerable:!0,configurable:!0,writable:!0,value:o}):A[m]=o,F=(A,m,o)=>(H(A,typeof m!="symbol"?m+"":m,o),o);class $ extends s.Component{constructor(m){super(m),F(this,"shownListItems",[]),F(this,"_onPatternFilterChange",o=>{this.setState({patternFilter:o.target.value,activeListItem:-1})}),F(this,"_onPatternFilterKeyDown",o=>{const{addToPattern:B}=this.props,{activeListItem:I}=this.state,M=40,l=38,a=13,t=this.shownListItems[I];let n=0;const c=document.getElementById("list-item-0");let P,R;switch(o.keyCode){case M:if(n=I+1,I>=this.shownListItems.length)return;P=document.getElementById(`list-item-${n}`),R=P.parentElement,R.scrollTop=P.offsetTop-c.offsetTop,this.setState({activeListItem:n}),o.preventDefault();break;case l:if(n=I-1,n<0)return;P=document.getElementById(`list-item-${n}`),R=P.parentElement,R.scrollTop=P.offsetTop-c.offsetTop,this.setState({activeListItem:n}),o.preventDefault();break;case a:t&&B(t),o.preventDefault();break;default:break}}),this.state={patternFilter:"",activeListItem:-1}}shouldComponentUpdate(m,o){const{patterns:B}=this.props,{patternFilter:I,activeListItem:M}=this.state;return!(d()(m.patterns,B)&&I===o.patternFilter&&M===o.activeListItem)}render(){const{activeListItem:m,patternFilter:o}=this.state,{addToPattern:B,patterns:I}=this.props;let M,l;try{M=RegExp(o,"i")}catch(t){l=t==null?void 0:t.message}this.shownListItems=[];let a=[];return l||(a=I.filter(t=>M.test(t.name)).map((t,n)=>{const c=n===m;return this.shownListItems.push(t.name),s.createElement(C.ListGroupItem,{id:`list-item-${n}`,header:t.name,bsStyle:c?"info":void 0,onKeyDown:this._onPatternFilterKeyDown,key:t.name},s.createElement("span",{className:N.patternDisplay},t.pattern),s.createElement("span",{className:N.addButton},s.createElement(C.Button,{bsSize:"xsmall",bsStyle:"primary",onClick:()=>{B(t.name)}},"Add")))})),s.createElement(s.Fragment,null,s.createElement(C.Input,{type:"text",id:"pattern-selector",label:"Filter pattern",onChange:this._onPatternFilterChange,autoComplete:"off",formGroupClassName:N.filterFormGroup,onKeyDown:this._onPatternFilterKeyDown,value:o,error:l}),!l&&s.createElement(C.ListGroup,{bsClass:N.resultList},a))}}F($,"propTypes",{addToPattern:D().func.isRequired,patterns:D().array.isRequired});const X=$;var j=Object.defineProperty,J=(A,m,o)=>m in A?j(A,m,{enumerable:!0,configurable:!0,writable:!0,value:o}):A[m]=o,k=(A,m,o)=>(J(A,typeof m!="symbol"?m+"":m,o),o);class S extends s.Component{constructor(){super(...arguments),k(this,"shownListItems",[]),k(this,"_onPatternChange",m=>{const{onPatternChange:o}=this.props;o(m.target.value)}),k(this,"_addToPattern",m=>{const{pattern:o,onPatternChange:B}=this.props,I=this.patternInput.getInputDOMNode().selectionStart||o.length,M=`${o.slice(0,I)}%{${m}}${o.slice(I)}`;B(M)})}render(){const{className:m,patterns:o,pattern:B}=this.props;return this.shownListItems=[],s.createElement(C.Row,{className:m},s.createElement(C.Col,{sm:8},s.createElement(C.Input,{ref:I=>{this.patternInput=I},type:"textarea",id:"pattern-input",label:"Pattern",help:"The pattern which will match the log line e.g: '%{IP:client}' or '.*?'",rows:9,onChange:this._onPatternChange,value:B,required:!0})),s.createElement(C.Col,{sm:4},s.createElement(X,{addToPattern:this._addToPattern,patterns:o})))}}k(S,"propTypes",{pattern:D().string,patterns:D().array,onPatternChange:D().func,className:D().string}),k(S,"defaultProps",{pattern:"",patterns:[],onPatternChange:()=>{},className:""});const Y=S},"2ZvCF5AB":(K,O,r)=>{r.r(O),r.d(O,{default:()=>M});var e=r("Z7aTuO5B"),D=r("ii0bleBb"),s=r.n(D),C=r("J6y4/h8P"),E=r("IOI9nV80"),d=r("rIl5IEuP"),T=r("BqxuktKK"),G=r("v4GbOr/o"),w=r("5chL1ePP"),p=Object.defineProperty,v=(l,a,t)=>a in l?p(l,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[a]=t,i=(l,a,t)=>(v(l,typeof a!="symbol"?a+"":a,t),t);class g extends e.Component{constructor(a){super(a),i(this,"openModal",()=>{this.setState({showModal:!0})}),i(this,"_onPatternChange",t=>{this.setState({pattern:t})}),i(this,"_onNameChange",t=>{const{validPatternName:n}=this.props,c=t.target.value;n(c)?this.setState({name:c,error:!1,error_message:""}):this.setState({name:c,error:!0,error_message:"Pattern with that name already exists!"})}),i(this,"_onSampleDataChange",t=>{this.setState({sampleData:t.target.value})}),i(this,"_getId",t=>{const{name:n}=this.state;return n!==void 0?t+n:t}),i(this,"_closeModal",()=>{this.setState({showModal:!1})}),i(this,"_saved",()=>{const{create:t,sendTelemetry:n}=this.props;n(G.g.GROK_PATTERN[t?"CREATED":"UPDATED"],{app_pathname:"grokpatterns",app_section:"grokpatterns"}),this._closeModal(),t&&this.setState({name:"",pattern:"",sampleData:"",test_result:""})}),i(this,"_save",()=>{const{savePattern:t}=this.props,{error:n}=this.state;n||t(this.state,this._saved)}),i(this,"_sendTelemetry",()=>{this.props.sendTelemetry(G.g.GROK_PATTERN.TESTED,{app_pathname:"grokpatterns",app_section:"grokpatterns"})}),i(this,"_testPattern",()=>{const{name:t,pattern:n}=this.state,{testPattern:c}=this.props;if(t===""||n===""){this.setState({error:!0,error_message:"To test the pattern a name and a pattern must be given!"});return}this.setState({error:!1,error_message:""}),c(this.state,P=>{this.setState({test_result:JSON.stringify(P,null,2),test_error:void 0}),this._sendTelemetry()},P=>{this.setState({test_result:"",test_error:P}),this._sendTelemetry()})}),this.state={showModal:!1,id:a.id,name:a.name,pattern:a.pattern,sampleData:a.sampleData,test_result:"",test_error:void 0,error:!1,error_message:""}}render(){const{create:a,patterns:t}=this.props,{showModal:n,name:c,error:P,error_message:R,pattern:x,test_error:U,sampleData:z,test_result:V}=this.state;let Z;return a?Z="Create pattern":Z=e.createElement("span",null,"Edit"),e.createElement("span",null,e.createElement(d.Button,{onClick:this.openModal,bsStyle:a?"success":"default",bsSize:a?void 0:"xs"},Z),e.createElement(d.BootstrapModalForm,{show:n,title:`${a?"Create":"Edit"} Grok Pattern ${c}`,"data-telemetry-title":`${a?"Create":"Edit"} Grok Pattern`,bsSize:"large",onSubmitForm:this._save,onCancel:this._closeModal,submitButtonText:`${a?"Create":"Update"} pattern`},e.createElement("fieldset",null,e.createElement(d.Input,{type:"text",id:this._getId("pattern-name"),label:"Name",onChange:this._onNameChange,value:c,bsStyle:P?"error":null,help:P?R:"Under this name the pattern will be stored and can be used like: '%{THISNAME}' later on ",autoFocus:!0,required:!0}),e.createElement(w.A,{onPatternChange:this._onPatternChange,pattern:x,patterns:t}),U&&e.createElement(d.Panel,{bsStyle:"danger",header:"Grok Error"},e.createElement("code",{style:{display:"block",whiteSpace:"pre-wrap"}},U)),e.createElement(d.Input,{type:"textarea",id:this._getId("sampleData"),label:"Sample Data",help:"Here you can add sample data to test your pattern",onChange:this._onSampleDataChange,value:z}),e.createElement(d.Button,{bsStyle:"info",onClick:this._testPattern},"Test with Sample Data"),e.createElement("br",null),e.createElement("br",null),e.createElement(d.Input,{type:"textarea",id:this._getId("test_result"),readOnly:!0,rows:8,help:"Will contain the result of your test in a JSON format",label:"Test Result",value:V}))))}}i(g,"propTypes",{id:s().string,name:s().string,pattern:s().string,patterns:s().array,create:s().bool,sampleData:s().string,savePattern:s().func.isRequired,testPattern:s().func.isRequired,validPatternName:s().func.isRequired,sendTelemetry:s().func}),i(g,"defaultProps",{id:"",name:"",pattern:"",patterns:[],create:!1,sampleData:"",sendTelemetry:()=>{}});const h=(0,T.A)(g);var u=r("jAGDuYSC"),y=r("gTexEe+8"),f=r("ZYJ7aiK3"),_=Object.defineProperty,L=(l,a,t)=>a in l?_(l,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[a]=t,b=(l,a,t)=>(L(l,typeof a!="symbol"?a+"":a,t),t);class W extends e.Component{constructor(a){super(a),b(this,"_openModal",()=>{this.setState({showModal:!0})}),b(this,"_closeModal",()=>{this.setState({importStrategy:"ABORT_ON_CONFLICT",showModal:!1})}),b(this,"_onSubmit",t=>{t.preventDefault();const n=new FileReader,{importStrategy:c}=this.state,{onSuccess:P}=this.props;n.onload=R=>{const x=R.target.result;f.q.bulkImport(x,c).then(()=>{u.A.success("Grok Patterns imported successfully","Success!"),this._closeModal(),this.props.sendTelemetry(G.g.GROK_PATTERN.IMPORTED,{app_pathname:"grokpatterns",app_section:"grokpatterns"}),P()})},n.readAsText(this.patternFile.getInputDOMNode().files[0])}),b(this,"_onImportStrategyChange",t=>this.setState({importStrategy:t.target.value})),this.state={showModal:!1,importStrategy:"ABORT_ON_CONFLICT"}}render(){return e.createElement("span",null,e.createElement(d.Button,{bsStyle:"info",style:{marginRight:5},onClick:this._openModal},"Import pattern file"),e.createElement(y.A,{show:this.state.showModal,title:"Import Grok patterns from file",submitButtonText:"Upload",onCancel:this._closeModal,onSubmitForm:this._onSubmit},e.createElement(d.Input,{id:"pattern-file",type:"file",ref:a=>{this.patternFile=a},name:"patterns",label:"Pattern file",help:"A file containing Grok patterns, one per line. Name and patterns should be separated by whitespace.",required:!0}),e.createElement(d.Input,{id:"abort-on-conflicting-patterns-radio",type:"radio",name:"import-strategy",value:"ABORT_ON_CONFLICT",label:"Abort import if a pattern with the same name already exists",defaultChecked:!0,onChange:a=>this._onImportStrategyChange(a)}),e.createElement(d.Input,{id:"replace-conflicting-patterns-radio",type:"radio",name:"import-strategy",value:"REPLACE_ON_CONFLICT",label:"Replace existing patterns with the same name",onChange:a=>this._onImportStrategyChange(a)}),e.createElement(d.Input,{id:"drop-existing-patterns-radio",type:"radio",name:"import-strategy",value:"DROP_ALL_EXISTING",label:"Drop all existing patterns before import",onChange:a=>this._onImportStrategyChange(a)})))}}b(W,"propTypes",{onSuccess:s().func.isRequired,sendTelemetry:s().func}),W.defaultProps={sendTelemetry:()=>{}};const N=(0,T.A)(W);var Q=r("XyJ0Mvpg"),H=r("rlwexfKi");const F={pattern:"The pattern of the grok pattern"},$=e.createElement("p",null,"Find grok patterns containing COMMON in the pattern:",e.createElement("br",null),e.createElement("kbd",null,"pattern:COMMON"),e.createElement("br",null)),j=()=>e.createElement(H.A,{entityName:"grok pattern",commonFields:["name"],fieldMap:F,example:$});var J=Object.defineProperty,k=(l,a,t)=>a in l?J(l,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[a]=t,S=(l,a,t)=>(k(l,typeof a!="symbol"?a+"":a,t),t);const Y=(0,C.default)(E.bQ)`
  th.name {
    min-width: 200px;
  }

  td {
    word-break: break-all;
  }
`,A=(l,a,t)=>{f.q.testPattern(l,a,t)},m=l=>{let a;switch(l.toLocaleLowerCase()){case"name":a=e.createElement("th",{className:"name"},l);break;case"actions":a=e.createElement("th",{className:"actions"},l);break;default:a=e.createElement("th",null,l)}return a};class o extends e.Component{constructor(a){super(a),S(this,"loadData",(t,n=this.props.paginationQueryParameter.page,c=this.props.paginationQueryParameter.pageSize)=>{const{pagination:{query:P}}=this.state;this.loadPromise=f.q.searchPaginated(n,c,P).then(({patterns:R,pagination:x})=>{var U;t&&t(),(U=this.loadPromise)!=null&&U.isCancelled()||(this.loadPromise=void 0,this.setState({patterns:R,pagination:x}))})}),S(this,"validPatternName",t=>{const{patterns:n}=this.state;return!n.some(c=>c.name===t)}),S(this,"savePattern",(t,n)=>{f.q.savePattern(t,()=>{n(),this.loadData()})}),S(this,"_onPageChange",(t,n)=>{this.loadData(null,t,n)}),S(this,"_onSearch",(t,n)=>{const{pagination:c}=this.state,P=Object.assign(c,{query:t});this.props.paginationQueryParameter.resetPage(),this.setState({pagination:P},()=>this.loadData(n))}),S(this,"_onReset",()=>{const{pagination:t}=this.state,n=Object.assign(t,{query:""});this.props.paginationQueryParameter.resetPage(),this.setState({pagination:n},this.loadData)}),S(this,"confirmedRemove",t=>{window.confirm(`Really delete the grok pattern ${t.name}?
It will be removed from the system and unavailable for any extractor. If it is still in use by extractors those will fail to work.`)&&f.q.deletePattern(t,()=>{this.props.sendTelemetry(G.g.GROK_PATTERN.DELETED,{app_pathname:"grokpatterns",app_section:"grokpatterns"}),this.loadData()})}),S(this,"_patternFormatter",t=>{const{patterns:n}=this.state,c=n.filter(P=>P.name!==t.name);return e.createElement("tr",{key:t.id},e.createElement("td",null,t.name),e.createElement("td",null,t.pattern),e.createElement("td",null,e.createElement(d.ButtonToolbar,null,e.createElement(E.Wj,{permissions:"inputs:edit"},e.createElement(h,{id:t.id,name:t.name,pattern:t.pattern,testPattern:A,patterns:c,create:!1,reload:this.loadData,savePattern:this.savePattern,validPatternName:this.validPatternName}),e.createElement(d.Button,{style:{marginRight:5},bsStyle:"danger",bsSize:"xs",onClick:()=>this.confirmedRemove(t)},"Delete")))))}),this.state={patterns:[],pagination:{count:0,total:0,query:""}}}componentDidMount(){this.loadData()}componentWillUnmount(){this.loadPromise&&this.loadPromise.cancel()}render(){const a=["Name","Pattern","Actions"],{pagination:t,patterns:n}=this.state,c=e.createElement(j,null);return e.createElement("div",null,e.createElement(E.zY,{title:"Grok patterns",actions:e.createElement(E.Wj,{permissions:"inputs:edit"},e.createElement(d.ButtonToolbar,null,e.createElement(N,{onSuccess:this.loadData}),e.createElement(h,{id:"",name:"",pattern:"",patterns:n,create:!0,testPattern:A,reload:this.loadData,savePattern:this.savePattern,validPatternName:this.validPatternName})))},e.createElement("span",null,"This is a list of grok patterns you can use in your Graylog grok extractors. You can add your own manually or import a whole list of patterns from a so called pattern file.")),e.createElement(d.Row,{className:"content"},e.createElement(d.Col,{md:12},e.createElement(E.Wj,{permissions:"inputs:read"},e.createElement(d.Row,{className:"row-sm"},e.createElement(d.Col,{md:8},e.createElement(E.B9,{onSearch:this._onSearch,onReset:this._onReset,queryHelpComponent:c,useLoadingState:!0}))),e.createElement(d.Row,null,e.createElement(d.Col,{md:12},e.createElement(E.OW,{onChange:this._onPageChange,totalItems:t.total},e.createElement(Y,{id:"grok-pattern-list",className:"table-striped table-hover",headers:a,headerCellFormatter:m,sortByKey:"name",rows:n,noDataText:"No grok patterns have been found.",dataRowFormatter:this._patternFormatter}))))))))}}S(o,"propTypes",{paginationQueryParameter:s().object.isRequired,sendTelemetry:s().func}),o.defaultProps={sendTelemetry:()=>{}};const B=(0,T.A)((0,Q.A)(o)),M=()=>e.createElement(E.Qc,{title:"Grok patterns"},e.createElement(B,null))},ZYJ7aiK3:(K,O,r)=>{r.d(O,{q:()=>w});var e=r("JnTtTRmZ"),D=r.n(e),s=r("eFxcQyPT"),C=r("gyRmhZSW"),E=r("U1Iufsob"),d=r("MdYBRjRJ"),T=r("jAGDuYSC"),G=r("IA3Ku5lS");const w=(0,G.Bv)("core.GrokPatterns",()=>D().createStore({URL:(0,d.H3)("/system/grok"),loadPatterns(p){const v=i=>{T.A.error(`Loading Grok patterns failed with status: ${i.message}`,"Could not load Grok patterns")};return(0,s.Ay)("GET",this.URL).then(i=>{const{patterns:g}=i;return g.sort((h,u)=>h.name.toLowerCase().localeCompare(u.name.toLowerCase())),p(g),i},v)},searchPaginated(p,v,i){const g=(0,C.A)(E.A.GrokPatternsController.paginated().url,p,v,i);return(0,s.Ay)("GET",(0,d.H3)(g)).then(h=>{const u={count:h.count,total:h.total,page:h.page,perPage:h.per_page,query:i};return{patterns:h.patterns,pagination:u}}).catch(h=>{T.A.error(`Loading patterns failed with status: ${h}`,"Could not load streams")})},testPattern(p,v,i){const g=u=>{let y=u.message;const f=u.additional.body;f&&f.message&&(y=u.additional.body.message),i(y)},h={grok_pattern:{name:p.name,pattern:p.pattern},sampleData:p.sampleData};(0,s.Ay)("POST",(0,d.H3)(E.A.GrokPatternsController.test().url),h).then(u=>(v(u),u),g)},savePattern(p,v){const i=y=>{let f=y.message;const _=y.additional.body;_&&_.message&&(f=y.additional.body.message),T.A.error(`Testing Grok pattern "${p.name}" failed with status: ${f}`,"Could not test Grok pattern")},g={id:p.id,pattern:p.pattern,name:p.name,content_pack:p.content_pack};let h=this.URL,u;p.id===""?u="POST":(h+=`/${p.id}`,u="PUT"),(0,s.Ay)(u,h,g).then(y=>{v();const f=p.id===""?"created":"updated",_=`Grok pattern "${p.name}" successfully ${f}`;return T.A.success(_),y},i)},deletePattern(p,v){const i=g=>{T.A.error(`Deleting Grok pattern "${p.name}" failed with status: ${g.message}`,"Could not delete Grok pattern")};(0,s.Ay)("DELETE",`${this.URL}/${p.id}`).then(g=>(v(),T.A.success(`Grok pattern "${p.name}" successfully deleted`),g),i)},bulkImport(p,v){const i=h=>{let u=h.message;const y=h.additional.body;if(y&&y.validation_errors&&y.validation_errors._){u="";const f=y.validation_errors._;for(let _=0,L=f.length;_




© 2015 - 2024 Weber Informatics LLC | Privacy Policy