mhashemi

Export debug-command results

Recommended Posts

I am looking for a way to export the results of various debug commands. Specifically, I think it would be useful to be able to export large datasets, such as the results of !tlist or !adlist. Reading the results in the debug window is not ideal.

Share this post


Link to post
Share on other sites

So I am not sure this is what you want, and it may scare the heck out of you as it did me, but you can do this via the API.  Here is a segment of code we developed to deal with the fact that LM does not allow you to manually extend the IP list for a device (currently) and we were unable to get NetFlow data associated to higher end Palo Alto firewalls otherwise.

And, I warned you.  This is scary.  It is LESS scary now as when I first did it, the requirements were HTTP basic authentication, not an API keyset.  As far as I recall, this one is a v2 API path.  Code fragment is from a Perl script, but should be reasonably clear for alternate language development.

my $cmdline = "!hostproperty action=add host=$host property=ips value=@{[join(',', @iplist)]}";
my $content = to_json({"cmdline" => $cmdline});
verbose 1, "content = $content\n";

if ($dryrun){
    print qq(post(path => "/debug", content => $content, _scope => "internal", collectorId => $collector)), "\n";
}
else {
    my $response = $lmapi->post(path => "/debug", content => $content, _scope => "internal", collectorId => $collector);
    warn "Response:\n" . Dumper($response) . "\n" if $debug;
}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.