Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get any data #343

Open
danlupascu opened this issue Nov 15, 2017 · 11 comments
Open

Can't get any data #343

danlupascu opened this issue Nov 15, 2017 · 11 comments

Comments

@danlupascu
Copy link

danlupascu commented Nov 15, 2017

Hello. Thank you for this great package.

I installed the tracker, everything went smooth.

But when I go to /stats page it is not showing any data. All sections are empty.

When I check the database, the table tracker_log is empty. In fact, almost all of the tables are empty, besides three tables: tracker_errors, tracker_routes and tracker_routes_paths.

So, when I go to a page, I can see that it was recorded because it adds it in tracker_routes. But there is nothing in tracker_logs or sessions, etc.

here is my config file

return [

/*
 * Enable it?
 */
'enabled' => true,

/*
 * Enable cache?
 */
'cache_enabled' => true,

/*
 * Deffer booting for middleware use
 */
'use_middleware' => true,

/*
 * Robots should be tracked?
 */
'do_not_track_robots' => true,

/*
 * Which environments are not trackable?
 */
'do_not_track_environments' => [
],

/*
 * Which routes names are not trackable?
 */
'do_not_track_routes' => [
    'tracker.stats.*',
],

/*
 * Which route paths are not trackable?
 */
'do_not_track_paths' => [
    'api/*',
],

/*
 * The Do Not Track Ips is used to disable Tracker for some IP addresses:
 *
 *     '127.0.0.1', '192.168.1.1'
 *
 * You can set ranges of IPs
 *     '192.168.0.1-192.168.0.100'
 *
 * And use net masks
 *     '10.0.0.0/32'
 *     '172.17.0.0/255.255.0.0'
 */
'do_not_track_ips' => [
],

/*
 * When an IP is not trackable, show a message in log.
 */
'log_untrackable_sessions' => true,

/*
 * Log every single access?
 *
 * The log table can become huge if your site is popular, but...
 *
 * Log table is also responsible for storing information on:
 *
 *    - Routes and controller actions accessed
 *    - HTTP method used (GET, POST...)
 *    - Error log
 *    - URL queries (including values)
 */
'log_enabled' => true,

/*
 * Log artisan commands?
 */
'console_log_enabled' => false,

/*
 * Log SQL queries?
 *
 * Log must be enabled for this option to work.
 */
'log_sql_queries' => false,

/*
 * If you prefer to store Tracker data on a different database or connection,
 * you can set it here.
 *
 * To avoid SQL queries log recursion, create a different connection for Tracker,
 * point it to the same database (or not) and forbid logging of this connection in
 * do_not_log_sql_queries_connections.
 */
'connection' => 'tracker',

/*
 * Forbid logging of SQL queries for some connections.
 *
 * To avoid recursion, you better ignore Tracker connection here.
 *
 * Please create a separate database connection for Tracker. It can hit
 * the same database of your application, but the connection itself
 * has to have a different name, so the package can ignore its own queries
 * and avoid recursion.
 *
 */
'do_not_log_sql_queries_connections' => [
    'tracker',
],

/*
 * GeoIp2 database path.
 *
 * To get a fresh version of this file, use the command
 *
 *      php artisan tracker:updategeoip
 *
 */

'geoip_database_path' => __DIR__.'/geoip', //storage_path('geoip'),

/*
 * Also log SQL query bindings?
 *
 * Log must be enabled for this option to work.
 */
'log_sql_queries_bindings' => false,

/*
 * Log events?
 */
'log_events' => false,

/*
 * Which events do you want to log exactly?
 */
'log_only_events' => [
    // defaults to logging all events
],

/*
 * What are the names of the id columns on your system?
 *
 * 'id' is the most common, but if you have one or more different,
 * please add them here in your preference order.
 */
'id_columns_names' => [
    'id',
],
/*
 * Do not log events for the following patterns.
 * Strings accepts wildcards:
 *
 *    eloquent.*
 *
 */
'do_not_log_events' => [
    'illuminate.log',
    'eloquent.*',
    'router.*',
    'composing: *',
    'creating: *',
],

/*
 * Do you wish to log Geo IP data?
 *
 * You will need to install the geoip package
 *
 *     composer require "geoip/geoip":"~1.14"
 *
 * And remove the PHP module
 *
 *     sudo apt-get purge php5-geoip
 *
 */
'log_geoip' => true,

/*
 * Do you wish to log the user agent?
 */
'log_user_agents' => true,

/*
 * Do you wish to log your users?
 */
'log_users' => true,

/*
 * Do you wish to log devices?
 */
'log_devices' => true,

/*
 * Do you wish to log languages?
 */
'log_languages' => false,

/*
 * Do you wish to log HTTP referers?
 */
'log_referers' => false,

/*
 * Do you wish to log url paths?
 */
'log_paths' => true,

/*
 * Do you wish to log url queries and query arguments?
 */
'log_queries' => true,

/*
 * Do you wish to log routes and route parameters?
 */
'log_routes' => true,

/*
 * Log errors and exceptions?
 */
'log_exceptions' => true,

/*
 * A cookie may be created on your visitor device, so you can have information
 * on everything made using that device on your site.	 *
 */
'store_cookie_tracker' => true,

/*
 * If you are storing cookies, you better change it to a name you of your own.
 */
'tracker_cookie_name' => 'rentos_tracker_cookie',

/*
 * Internal tracker session name.
 */
'tracker_session_name' => 'tracker_session',

/*
 * ** IMPORTANT **
 *   Change the user model to your own.
 */
'user_model' => 'App\User',

/*
 * You can use your own model for every single table Tracker has.
 */

'session_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Session',

'log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Log',

'path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Path',

'query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Query',

'query_argument_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\QueryArgument',

'agent_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Agent',

'device_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Device',

'cookie_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Cookie',

'domain_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Domain',

'referer_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Referer',

'referer_search_term_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RefererSearchTerm',

'route_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Route',

'route_path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePath',

'route_path_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePathParameter',

'error_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Error',

'geoip_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\GeoIp',

'sql_query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQuery',

'sql_query_binding_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBinding',

'sql_query_binding_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBindingParameter',

'sql_query_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryLog',

'connection_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Connection',

'event_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Event',

'event_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\EventLog',

'system_class_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SystemClass',

'language_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Language',

/*
 * Laravel internal variables on user authentication and login.
 */
'authentication_ioc_binding' => ['auth'], // defaults to 'auth' in Illuminate\Support\Facades\Auth

'authenticated_check_method' => 'check', // to Auth::check()

'authenticated_user_method' => 'user', // to Auth::user()

'authenticated_user_id_column' => 'id', // to Auth::user()->id

'authenticated_user_username_column' => 'email', // to Auth::user()->email

/*
 * Enable the Stats Panel?
 */
'stats_panel_enabled' => true,

/*
 * Stats Panel routes before filter
 *
 */
'stats_routes_before_filter' => '',

/*
 * Stats Panel routes after filter
 *
 */
'stats_routes_after_filter' => '',

/*
 * Stats Panel routes middleware
 *
 */
'stats_routes_middleware' => 'web',

/*
 * Stats Panel template path
 */
'stats_template_path' => '/templates/sb-admin-2',

/*
 * Stats Panel base uri.
 *
 * If your site url is http://wwww.mysite.com, then your stats page will be:
 *
 *    http://wwww.mysite.com/stats
 *
 */
'stats_base_uri' => 'stats',

/*
 * Stats Panel layout view
 */
'stats_layout' => 'pragmarx/tracker::layout',

/*
 * Stats Panel controllers namespace
 */
'stats_controllers_namespace' => 'PragmaRX\Tracker\Vendor\Laravel\Controllers',

];

Laravel version: 5.4.36
PHP version: 7.1.7

Maybe it's a well known bug and you can help me. Thank you.

@murtaza-20
Copy link

Same issue

@samcodes-io
Copy link

same issue here, did anyone find a solution for that? any help would be appreciated
thanks :)

@alexandreMesle
Copy link

It seems to me that this package uses the middleware to log data, did you do the Kernel.php file modification described in the installation instructions ?

@techmatevaibhav
Copy link

Make sure your configuration is proper

As you are using localhost make sure you do the following modifications to your tracker file:
1 - make sure you enable the options that you want to track. Eg:
'log_geoip' => false,

/*

  • Do you wish to log the user agent?
    */
    'log_user_agents' => true,

/*

  • Do you wish to log your users?
    */
    'log_users' => true,

/*

  • Do you wish to log devices?
    */
    'log_devices' => true,

/*

  • Do you wish to log languages?
    */
    'log_languages' => false,

/*

  • Do you wish to log HTTP referers?
    */
    'log_referers' => false,

/*

  • Do you wish to log url paths?
    */
    'log_paths' => true
    2- Remove the localhost address (127.0.0.0/24) from "do_not_track_ips" option:

/*

  • The Do Not Track Ips is used to disable Tracker for some IP addresses:
  • '127.0.0.1', '192.168.1.1'
    
  • You can set ranges of IPs
  • '192.168.0.1-192.168.0.100'
    
  • And use net masks
  • '10.0.0.0/32'
    
  • '172.17.0.0/255.255.0.0'
    

*/
'do_not_track_ips' => [
'', /// range 127.0.0.1 - 127.0.0.255
],

@danlupascu
Copy link
Author

danlupascu commented Feb 28, 2018

@alexandreMesle yes, I did the modifications in Kernel.php. If I wouldn't do it then it wouldn't be working at all. I am able to access the stats page, but I can't see any stats.

@techmatevaibhav I tested it in a live environment and from multiple devices and it was not working. You can see the configuration in the issue description.

@alexandreMesle
Copy link

There are several arrays in the Kernel.php file, please make sure you made the insertion in the 'web' array.

@TheAhmedGad
Copy link

Did You added the package middleware to the kernel.php file ?

@iMezied
Copy link

iMezied commented May 16, 2018

did you run artisan config:cache after updating the configuration?

@jayenne
Copy link

jayenne commented Jun 4, 2018

i'm not saving any geoip data either. I have a very default setup nad have cover all steps and "fixes" but still not saving data.
The one thing I don't know for sure is what would be a typical expected/example output from this value? "'geoip_database_path' => DIR.'/geoip'," (so I can understand and replicate)

also, does it work for a localhost (homestead/vagrant box)? (as I've not set up and tested on a remotly hosted staging server yet)

@danlupascu
Copy link
Author

@jayenne I don't know wether it works locally or not but I know that I deployed it to a server and I had the same result, it wasn't working either.

@oxinorenzchler
Copy link

Well that answer's my problem Thank you so much @techmatevaibhav I forgot that I'm using localhost lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants