trinity / logger
Trinity Logger bundle
Installs: 4 111
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 16
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.1
- doctrine/orm: ~2.5
- elasticsearch/elasticsearch: ~5.0
- guzzlehttp/guzzle: ~6.3
- symfony/config: ~2.8|~3.0
- symfony/dependency-injection: ~2.8|~3.0
- symfony/expression-language: ~2.8|~3.0
- symfony/http-kernel: ~2.8 | ~3.0
- symfony/monolog-bundle: ~2.8 | ~3.0
- symfony/security-core: ~2.8|~3.0
- trinity/core-interfaces: ~1.0
- trinity/search: ~1.0
- trinity/utils: ~1.0
Requires (Dev)
- phpstan/phpstan: ~0.9
- phpunit/phpunit: ~6
- satooshi/php-coveralls: 1.0.*
- symfony/var-dumper: ~3.0
README
This bundle is reconstructed for new elasticsearch (v5) and the read me is not actualized yet. TODO
Bundle for storing and loading logs in ElasticSearch database.
Write issue if you found something that doesn't work as it should.
Logger creates new index each day in format YYYY-MM-DD. It works with environment and as for now two types are used. Development and Production logs are written into same index. The test environment adds prefix 'test-' before the index.
Thanks to this the logs may be viewed directly by using URL:
http:\\elastic_host:port\YYYY-MM-DD\LogName\LogId
for example:
trinity_logger:
elastic_logs:
elastic_host: '127.0.0.1:9200'
managed_index: 'necktie'
Configured index can be changed when method is called.
Classic call:
$this->get('trinity.elastic.read.log.service')->getCount('ExceptionLog');
Call different index:
$this->get('trinity.elastic.read.log.service')->setIndex('venice')->getCount('ExceptionLog');
For searching it is required to know where is entity class stored. Most classes are stored on same place and therefor they can be added into configuration as follow:
trinity_logger:
elastic_logs:
elastic_host: '127.0.0.1:9200'
managed_index: 'necktie'
entities_path: 'Necktie\\AppBundle\\Entity'
When we use nqlQuery (see trinity/search for more about used nqlQuery) we can call:
$entities = $this->get('trinity.elastic.read.log.service')->getByQuery($nqlQuery);
If entity definition is stored elsewhere, we go for example as this:
$entities = $this->get('trinity.elastic.read.log.service')
->setEntityPath('Necktie\\PaymentBundle\\Entity')
->getByQuery($nqlQuery);
Note: ElasticSearch is noSQL database.... NO!!!SQL therefor it will go with only queries under one entity. If you need join something use relation based SQL database.
As main use of this bundle for now is Necktie, following values are used as default and doesn't require configuration. managed_index: 'necktie' entities_path: 'Necktie\AppBundle\Entity'