}, getClients:async ( req, res, next ) => {
const conn = new Client();
conn.on( 'ready', () => {
- const command = `cat /var/log/openvpn/openvpn-status.log | grep "OpenVPN CLIENT LIST`;
+ const command = `cat /var/log/openvpn/openvpn-status.log`;
conn.exec( command, ( err, stream ) => {
if (err) {
conn.end();
stream.on( 'close', ( code ) => {
conn.end();
if (code === 0) {
- const clients = output.split( '\n' ).filter( line => line.includes( 'CLIENT_LIST' ) ).map( line => {
+ const clients = output.split( '\n' ).filter( line => line.startsWith( 'Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since' ) ).map( line => {
const parts = line.split( ',' );
return { name:parts[1], ip:parts[2], connectedSince:parts[8] };
} );