title: angular errors log send to elasticsearch
body: <p>I have an angular project version 10.0.2
  I want to log all errors on developer console to elastic search.
  When I catch an error on the global error handler my handler inside like this.</p>
  <pre><code>export class GlobalErrorHandlerService extends ErrorHandler {
      constructor(private log: LogService) {
          super();
      }
      handleError(error: any) {
          var client = new Client();
          if (error instanceof HttpErrorResponse) {
              this.log.level = LogLevel.Error;
              this.log.error(&quot;API/Back-End Proccess request error   &quot; + JSON.stringify(error), JSON.stringify(error));
          }
          else {
              this.log.level = LogLevel.Warn;
              this.log.warn(&quot;Client side error &quot; + JSON.stringify(error), JSON.stringify(error));
          }
          this.log.publishers.push(error);
      }
  } 
  </code></pre>
  <p>LogService is my custom log service. But I can change it to catch errors
  i send it elastic like this.</p>
  <p><code>entry:</code> include error information</p>
  <pre><code>log(entry: LogEntry): Observable&lt;boolean&gt; {
  
          var headers = new HttpHeaders();
          const date = moment();
  
          let body = {
              &quot;@timestamp&quot;: date,
              &quot;index&quot;: &quot;clientapplication&quot;,
              &quot;body&quot;: {
                  &quot;entry&quot;: entry,
                  &quot;date&quot;: date
              },
              &quot;user&quot;: {
                  &quot;fullname&quot;: &quot;ahmetu&quot;,
                  &quot;userrecordno&quot;: &quot;190909&quot;
              }
          }
  
          headers.append('Content-Type', 'application/json');
          headers.append('Accept', 'application/json');
          return this.hbhttp.post(`${this.location}/hbizclient/_doc`, body, headers)
      }
  </code></pre>
  <p>i did this operation in <code>log.elastic.ts</code>
  i writen custom a logging operation. my folder stracture as below</p>
  <p><a href="https://i.stack.imgur.com/kpUtX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kpUtX.png" alt="My folder stracture" /></a></p>
  <p>Actually i can logging all errors but i just want to learn. how can i use Elasticsearch own npm package then send all error from angular to elastic then i can see all of these on kibana</p>
  <p>thanks for suggestions</p>