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

web-interface.assets.1255d548-7466.83a666d83924acd3032d.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-7466"],{SfPIQIJE:(B,R,n)=>{n.d(R,{Z:()=>C});var e=n("Z7aTuO5B"),P=n("J6y4/h8P"),v=n("uZqmR+ju"),f=n("ty2gyrHp"),a=n("/GOzvPf6"),g=n("NV1/EHMi");const E=(0,P.default)(v.ButtonToolbar)`
  margin-bottom: 10px;
`,d=(0,P.default)(v.Button)(({theme:h})=>(0,P.css)`
  font-family: ${h.fonts.family.navigation};
  font-size: ${h.fonts.size.navigation};

  &&&& {
    color: ${h.colors.variant.darker.default};
    
    &:hover,
    &:focus {
      text-decoration: none;
    }

    > div {
      &:hover,
      &:focus {
        color: ${h.colors.variant.darker.default};
      }
    }

    &:hover {
      ${(0,g.RF)(h)}
    }

    &.active {
      color: ${h.colors.global.textDefault};

      ${(0,g.A7)(h)}

      &:hover,
      &:focus {
        ${(0,g.A7)(h)}
      }
    }
  }
`);d.displayName="Button";const C=({items:h})=>e.createElement(E,null,h.map(({path:t,title:o,permissions:l,exactPathMatch:m})=>t?e.createElement(a.AE,{permissions:l!=null?l:[],key:t},e.createElement(f.J,{to:t,relativeActive:!m},e.createElement(d,{bsStyle:"link"},e.createElement(g.ZP,null,o)))):null))},ZspbpBGx:(B,R,n)=>{n.d(R,{Z:()=>E});var e=n("Z7aTuO5B"),P=n("SfPIQIJE"),v=n("d4kzUuQm"),f=n("uZqmR+ju");const a=[{title:"Manage pipelines",path:v.ZP.SYSTEM.PIPELINES.OVERVIEW,exactPathMatch:!0},{title:"Manage rules",path:v.ZP.SYSTEM.PIPELINES.RULES},{title:"Simulator",path:v.ZP.SYSTEM.PIPELINES.SIMULATOR}],E=()=>e.createElement(f.Row,null,e.createElement(P.Z,{items:a}))},mLWLvpJt:(B,R,n)=>{n.r(R),n.d(R,{default:()=>ge});var e=n("Z7aTuO5B"),P=n("J6y4/h8P"),v=n("ZspbpBGx"),f=n("E+CaPsQD"),a=n("uZqmR+ju"),g=n("/GOzvPf6"),E=n("ii0bleBb"),d=n.n(E),D=n("ty2gyrHp"),C=n("nKnTKuph"),h=n("d4kzUuQm"),t=n("TJOheZRu");const o=30,l=P.default.td(({theme:r})=>(0,P.css)`
  max-width: 250px;
  min-width: 250px;
  
  @media screen and (max-width: ${r.breakpoints.max.md}) {
    white-space: normal !important;
  }
`),c=({rule:r,onDelete:s,usingPipelines:i})=>{const{id:p,title:T,description:L,created_at:K,modified_at:O}=r,b=i.length,_=r.rule_builder?"?rule_builder=true":"",U=e.createElement(a.ButtonToolbar,null,e.createElement(D.J,{to:`${h.ZP.SYSTEM.PIPELINES.RULE(p)}${_}`},e.createElement(a.Button,{bsSize:"xsmall"},"Edit")),e.createElement(a.Button,{bsStyle:"danger",bsSize:"xsmall",onClick:s(r),title:"Delete rule"},"Delete")),G=S=>S.map(({id:y,title:M},$)=>{const A=e.createElement(a.Tooltip,{id:`${p}${y}`,show:!0},M);return e.createElement(e.Fragment,{key:y},M.length>o?e.createElement(g.Ox,{placement:"top",trigger:"hover",overlay:A,rootClose:!0},e.createElement(D.r,{to:h.ZP.SYSTEM.PIPELINES.PIPELINE(y)},t.Z.truncateWithEllipses(M,o))):e.createElement(D.r,{to:h.ZP.SYSTEM.PIPELINES.PIPELINE(y)},M),$e.createElement("th",null,s),this._ruleInfoFormatter=s=>{const{onDelete:i,rulesContext:{used_in_pipelines:p}={}}=this.props;return e.createElement(c,{key:s.id,rule:s,usingPipelines:p[s.id],onDelete:i})}}render(){const{rules:s,searchFilter:i}=this.props,p=["Title","Description","Created","Last modified","Throughput","Errors","Pipelines","Actions"];return e.createElement(g.wQ,{id:"rule-list",className:"table-hover",headers:p,headerCellFormatter:this._headerCellFormatter,sortByKey:"title",rows:s,customFilter:i,dataRowFormatter:this._ruleInfoFormatter,filterKeys:[]})}}u.propTypes={rules:d().array.isRequired,rulesContext:d().exact({used_in_pipelines:d().objectOf(d().any)}),onDelete:d().func.isRequired,searchFilter:d().node.isRequired},u.defaultProps={rulesContext:void 0};const x=u;var w=n("8fnsnG21"),Z=n("sRNsEgBM"),H=n("IW7priiX"),V=n.n(H),X=n("S6FuRS7B"),k=Object.defineProperty,q=(r,s,i)=>s in r?k(r,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[s]=i,I=(r,s,i)=>(q(r,typeof s!="symbol"?s+"":s,i),i);class W extends e.Component{constructor(s){super(s),I(this,"saveConfiguration",()=>{const{onChange:i}=this.props,{nextConfig:p}=this.state;i(p).then(this.closeModal)}),I(this,"closeModal",()=>{this.props.onClose()}),I(this,"propagateChange",(i,p)=>{const{config:T}=this.props,L=V()(T);L[i]=p,this.setState({nextConfig:L})}),I(this,"handleChange",i=>{const{name:p}=i.target;this.propagateChange(p,X.n6(i.target))}),this.state={nextConfig:s.config}}render(){const{config:s}=this.props,{nextConfig:i}=this.state;return s?e.createElement(a.BootstrapModalForm,{show:!0,title:"Rule Metrics Configuration",onSubmitForm:this.saveConfiguration,onCancel:this.closeModal,submitButtonText:"Update configuration"},e.createElement(a.Alert,{bsStyle:"warning"},"Rule metrics should only be enabled to debug a performance issue because collecting the metrics will slow down message processing and increase memory usage."),e.createElement("fieldset",null,e.createElement(a.Input,{type:"radio",id:"metrics-enabled",name:"metrics_enabled",value:"true",label:"Enable rule metrics",onChange:this.handleChange,checked:i.metrics_enabled}),e.createElement(a.Input,{type:"radio",id:"metrics-disabled",name:"metrics_enabled",value:"false",label:"Disable rule metrics",onChange:this.handleChange,checked:!i.metrics_enabled})),e.createElement("p",null,"When enabled the system metrics will update two timers for every rule execution."),e.createElement("strong",null,"Rule evaluation timer"),e.createElement("p",null,"This timer measures the duration for the rule condition. (everything inside the ",e.createElement("code",null,"when")," statement)"),e.createElement("p",null,"Example metric name with rule ID placeholder:",e.createElement("br",null),e.createElement("code",null,"org.graylog.plugins.pipelineprocessor.ast.Rule.[rule-id].trace.evaluate.duration"),e.createElement("br",null),"Example metric name with rule ID, pipeline ID and stage number placeholders:",e.createElement("br",null),e.createElement("code",null,"org.graylog.plugins.pipelineprocessor.ast.Rule.[rule-id].[pipeline-id].[stage-num].trace.evaluate.duration")),e.createElement("strong",null,"Rule execution timer"),e.createElement("p",null,"This timer measures the duration for the rule execution. (everything inside the ",e.createElement("code",null,"then")," statement)"),e.createElement("p",null,"Example metric name with rule ID placeholder:",e.createElement("br",null),e.createElement("code",null,"org.graylog.plugins.pipelineprocessor.ast.Rule.[rule-id].trace.execute.duration"),e.createElement("br",null),"Example metric name with rule ID, pipeline ID and stage number placeholders:",e.createElement("br",null),e.createElement("code",null,"org.graylog.plugins.pipelineprocessor.ast.Rule.[rule-id].[pipeline-id].[stage-num].trace.execute.duration"))):e.createElement("p",null,e.createElement(g.$j,{text:"Loading metrics config..."}))}}I(W,"propTypes",{config:d().object,onChange:d().func.isRequired,onClose:d().func}),I(W,"defaultProps",{config:void 0,onClose:()=>{}});var ee=Object.defineProperty,te=(r,s,i)=>s in r?ee(r,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[s]=i,j=(r,s,i)=>(te(r,typeof s!="symbol"?s+"":s,i),i);const ne=r=>Z.W.updateMetricsConfig(r);class F extends e.Component{componentDidMount(){Z.W.loadMetricsConfig()}render(){const{metricsConfig:s,onClose:i}=this.props;return s?e.createElement(W,{config:s,onChange:ne,onClose:i}):null}}j(F,"propTypes",{metricsConfig:d().object,onClose:d().func}),j(F,"defaultProps",{metricsConfig:void 0,onClose:()=>{}});const se=(0,w.Z)(F,{rules:Z.G},({rules:r})=>({metricsConfig:r&&r.metricsConfig}));var le=n("ij/cnY+3"),re=n("rVdVsuGH"),oe=n("MdYBRjRJ"),ie=n("8OvTct/Z"),ae=n("0t7Ye+61"),ue=n("/7OuCFNo"),ce=n("v4GbOr/o");const de=P.default.div`
  display: flex;
`,me=P.default.div(({theme:r})=>(0,P.css)`
  font-size: ${r.fonts.size.h3};
  padding: ${r.spacings.xxs} ${r.spacings.sm};
`),Y=(r,s,i)=>{s(!0),Z.W.listPaginated(r).then(p=>{i(p),s(!1)})},z=r=>{Z.W.loadMetricsConfig().then(s=>{r(s)})},ge=()=>{const{page:r,pageSize:s,resetPage:i,setPagination:p}=(0,re.ZP)(),{pathname:T}=(0,ae.Z)(),L=(0,ue.Z)(),K=(0,ie.Z)(),[O,b]=(0,e.useState)(""),[_,U]=(0,e.useState)(!1),[G,S]=(0,e.useState)(!1),[y,M]=(0,e.useState)(),[$,A]=(0,e.useState)(),{list:J,pagination:{total:Ee=0}={},context:pe}=$!=null?$:{};(0,e.useEffect)(()=>{Y({query:O,page:r,perPage:s},U,A)},[O,r,s]),(0,e.useEffect)(()=>{z(M)},[]);const Q=N=>{i(),b(N)},fe=N=>()=>{window.confirm(`Do you really want to delete rule "${N.title}"?`)&&Z.W.delete(N).then(()=>{Y({query:O,page:r,perPage:s},U,A),p({page:Math.max(le._.page,r-1)})})},he=()=>{z(M),S(!1)},Ce=()=>y&&y.metrics_enabled?e.createElement(a.Button,{bsStyle:"warning",onClick:S},"Debug Metrics: ON"):e.createElement(a.Button,{onClick:S},"Debug Metrics"),Pe=()=>e.createElement(a.ButtonToolbar,{className:"pull-right"},e.createElement(a.Button,{bsStyle:"success",onClick:()=>{K(ce.A.PIPELINE_RULE_BUILDER.CREATE_RULE_CLICKED,{app_pathname:(0,oe.av)(T),app_section:"pipeline-rules",app_action_value:"create-rule-button"}),L.push(`${h.ZP.SYSTEM.PIPELINES.RULE("new")}?rule_builder=true`)}},"Create Rule"),Ce()),Re=!J,ve=e.createElement(de,null,e.createElement(g.UI,{query:O,onSearch:Q,queryHelpComponent:e.createElement(g.y8,{entityName:"Pipeline Rule"}),wrapperClass:"has-bm",onReset:()=>Q(""),topMargin:0}),_&&e.createElement(me,null,e.createElement(g.$j,{text:"",delay:0})));return e.createElement(g.$4,{title:"Pipeline rules"},e.createElement(v.Z,null),e.createElement(g.mr,{title:"Pipeline Rules",actions:e.createElement(Pe,null),documentationLink:{title:"Pipeline rules documentation",path:f.Z.PAGES.PIPELINE_RULES}},e.createElement("span",null,"Rules are a way of applying changes to messages in Graylog. A rule consists of a condition and a list of actions. Graylog evaluates the condition against a message and executes the actions if the condition is satisfied.")),e.createElement(a.Row,{className:"content"},e.createElement(a.Col,{md:12},Re?e.createElement(g.$j,null):e.createElement(a.Row,null,e.createElement(a.Col,{md:12},e.createElement(g.l9,{totalItems:Ee},e.createElement(x,{rules:J,rulesContext:pe,onDelete:fe,searchFilter:ve}),G&&e.createElement(se,{onClose:he})))))))}},"ij/cnY+3":(B,R,n)=>{n.d(R,{_:()=>e});const e={page:1,perPage:10,query:""}},sRNsEgBM:(B,R,n)=>{n.d(R,{G:()=>h,W:()=>C});var e=n("JnTtTRmZ"),P=n.n(e),v=n("4E3oowBb"),f=n("jAGDuYSC"),a=n("MdYBRjRJ"),g=n("gyRmhZSW"),E=n("U1Iufsob"),d=n("eFxcQyPT"),D=n("IA3Ku5lS");const C=(0,D.ei)("core.Rules",()=>P().createActions({delete:{asyncResult:!0},list:{asyncResult:!0},get:{asyncResult:!0},save:{asyncResult:!0},update:{asyncResult:!0},parse:{asyncResult:!0},simulate:{asyncResult:!0},multiple:{asyncResult:!0},loadFunctions:{asyncResult:!0},loadMetricsConfig:{asyncResult:!0},updateMetricsConfig:{asyncResult:!0},listPaginated:{asyncResult:!0}})),h=(0,D.dS)("core.Rules",()=>P().createStore({listenables:[C],rules:void 0,rulesContext:void 0,functionDescriptors:void 0,metricsConfig:void 0,getInitialState(){return{rules:this.rules,rulesContext:this.rulesContext,functionDescriptors:this.functionDescriptors,metricsConfig:this.metricsConfig}},_updateRulesState(t){this.rules?this.rules.some(l=>l.id===t.id)?this.rules=this.rules.map(l=>l.id===t.id?t:l):this.rules.push(t):this.rules=[t],this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors})},_updateFunctionDescriptors(t){t&&(this.functionDescriptors=t.sort((o,l)=>(0,v.S)(o.name,l.name))),this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors})},list(){const t=l=>{f.Z.error(`Fetching rules failed with status: ${l.message}`,"Could not retrieve processing rules")},o=(0,a.DC)(E.Z.RulesController.list().url);return(0,d.ZP)("GET",o).then(l=>{this.rules=l,this.trigger({rules:l,functionDescriptors:this.functionDescriptors})},t)},listPaginated({page:t,perPage:o,query:l}){const m=(0,g.Z)(E.Z.RulesController.paginatedList().url,t,o,l),c=(0,d.ZP)("GET",(0,a.DC)(m)).then(u=>({list:u.rules,context:u.context,pagination:{count:u.count,total:u.total,page:u.page,perPage:u.per_page,query:u.query}}));return c.catch(u=>{(!u.additional||u.additional.status!==404)&&f.Z.error(`Loading rules list failed with status: ${u}`,"Could not load rules.")}),C.listPaginated.promise(c),c},get(t){const o=c=>{f.Z.error(`Fetching rule "${t}" failed with status: ${c.message}`,`Could not retrieve processing rule "${t}"`)},l=(0,a.DC)(E.Z.RulesController.get(t).url),m=(0,d.ZP)("GET",l);return m.then(this._updateRulesState,o),C.get.promise(m),m},save(t){const o=u=>{f.Z.error(`Saving rule "${t.title}" failed with status: ${u.message}`,`Could not save processing rule "${t.title}"`)},l=(0,a.DC)(E.Z.RulesController.create().url),m={title:t.title,description:t.description,source:t.source,simulator_message:t.simulator_message},c=(0,d.ZP)("POST",l,m);return c.then(u=>(this._updateRulesState(u),f.Z.success(`Rule "${u.title}" created successfully`),u),o),C.save.promise(c),c},update(t){const o=u=>{f.Z.error(`Updating rule "${t.title}" failed with status: ${u.message}`,`Could not update processing rule "${t.title}"`)},l=(0,a.DC)(E.Z.RulesController.update(t.id).url),m={id:t.id,title:t.title,description:t.description,source:t.source,simulator_message:t.simulator_message},c=(0,d.ZP)("PUT",l,m);return c.then(u=>(this._updateRulesState(u),f.Z.success(`Rule "${u.title}" updated successfully`),u),o),C.update.promise(c),c},delete(t){const o=c=>{f.Z.error(`Deleting rule "${t.title}" failed with status: ${c.message}`,`Could not delete processing rule "${t.title}"`)},l=(0,a.DC)(E.Z.RulesController.delete(t.id).url),m=(0,d.ZP)("DELETE",l).then(()=>{var c;this.rules=(c=this.rules)==null?void 0:c.filter(u=>u.id!==t.id),this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors}),f.Z.success(`Rule "${t.title}" was deleted successfully`)},o);return C.delete.promise(m),m},parse(t,o){const l=(0,a.DC)(E.Z.RulesController.parse().url),m={title:t.title,description:t.description,source:t.source};return(0,d.ZP)("POST",l,m).then(c=>(o([]),c),c=>{c.status===400&&o(c.additional.body)})},simulate(t,o,l){const m=(0,a.DC)(o!=null&&o.rule_builder?E.Z.RuleBuilderController.simulate().url:E.Z.RulesController.simulate().url),c={message:t,rule_source:void 0,rule_builder_dto:void 0};if(o!=null&&o.rule_builder){const{source:u,...x}=o;c.rule_builder_dto={title:x.title,description:x.description,rule_builder:x.rule_builder}}else c.rule_source={title:o.title,description:o.description,source:o.source};return(0,d.ZP)("POST",m,c).then(l,()=>{})},multiple(t,o){const l=(0,a.DC)(E.Z.RulesController.multiple().url),m=(0,d.ZP)("POST",l,{rules:t});return m.then(o),m},loadFunctions(){if(this.functionDescriptors)return;const t=(0,a.DC)(E.Z.RulesController.functions().url);return(0,d.ZP)("GET",t).then(this._updateFunctionDescriptors)},loadMetricsConfig(){const t=(0,a.DC)(E.Z.RulesController.metricsConfig().url),o=(0,d.ZP)("GET",t);o.then(l=>{this.metricsConfig=l,this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors,metricsConfig:this.metricsConfig})},l=>{f.Z.error(`Couldn't load rule metrics config: ${l.message}`,"Couldn't load rule metrics config")}),C.loadMetricsConfig.promise(o)},updateMetricsConfig(t){const o=(0,a.DC)(E.Z.RulesController.metricsConfig().url),l=(0,d.ZP)("PUT",o,t);l.then(m=>{this.metricsConfig=m,this.trigger({rules:this.rules,functionDescriptors:this.functionDescriptors,metricsConfig:this.metricsConfig}),f.Z.success("Successfully updated rule metrics config")},m=>{f.Z.error(`Couldn't update rule metrics config: ${m.message}`,"Couldn't update rule metrics config")}),C.updateMetricsConfig.promise(l)}}))}}]);})();

//# sourceMappingURL=1255d548-7466.83a666d83924acd3032d.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy