Forum Discussion

mhashemi's avatar
6 years ago

Export debug-command results

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.

1 Reply

Replies have been turned off for this discussion
  • 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;